Dremendo Tag Line

Check buzz number in C++

if else - Question 10

In this question, we will see how to check if a number is a buzz number or not in C++ programming using the if else statement. To know more about if else statement click on the if else statement lesson.

Q10) Write a program in C++ to input a number and check if it is a buzz number or not. A number is a buzz number if it is divisible by 7 or if its last digit is 7. Make use of logical operator || to solve this question.


#include <iostream>
#include <conio.h>

using namespace std;

int main()
    int n;
    cout<<"Enter a number ";
    if(n%7==0 || n%10==7)
        cout<<"Buzz number";
        cout<<"Not a buzz number";
    return 0;


Enter a number 21
Buzz number