Computer Science, asked by irenerebeccamaria72, 4 months ago

Write a program to implement function overloading as follows:

a.display(int n)-Takes the number from main() and displays whether the number is a Buzz number or  not. (A number is a Buzz number if it’s last digit is 7 or if the number is divisible by 7.  Ex. 21 and 37 are Buzz numbers.)

b.display()-Displays the following series

1   +   2    +  3  +  4  +……..+  20

               

1!      2!       3!      4!                 20!     



Answers

Answered by suyoggogawale123
0

Answer:

Input : 63

Output : Buzz Number

Explanation: 63 is divisible by 7, one

of the condition is satisfied.

Input : 72

Output : Not a Buzz Number

Explanation: 72 % 7 != 0, 72 is neither

divisible by 7 nor it ends with 7 so

it is not a Buzz Number.

Recommended: Please try your approach on {IDE} first, before moving on to the solution.

// C++ program to check whether the

// given number is Buzz Number or not.

#include <cmath>

#include <iostream>

using namespace std;

// function to check BUzz number.

bool isBuzz(int num)

{

// checking if the number

// ends with 7 and is divisible by 7

return (num % 10 == 7 || num % 7 == 0);

}

// Driver method

int main(void)

{

int i = 67, j = 19;

if (isBuzz(i))

cout << "Buzz Number\n";

else

cout << "Not a Buzz Number\n";

if (isBuzz(j))

cout << "Buzz Number\n";

else

cout << "Not a Buzz Number\n";

}

Similar questions