Computer Science, asked by pranavrajapr7, 10 months ago

Write a program in python to accept a number and check whether it is a buzz number ( a buzz number is a number that ends with 7 or divisible by 7)

Answers

Answered by Anonymous
6

Answer:

// 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