Buzz number Algorithm

The Buzz Number Algorithm is a simple yet interesting mathematical concept that involves identifying numbers based on specific conditions. It focuses on numbers that either end with the digit 7, or are divisible by 7. These numbers are referred to as "Buzz numbers." The algorithm is commonly used in number games, programming exercises, and educational activities to help students learn about divisibility rules and number patterns. To implement the Buzz Number Algorithm, one can follow these basic steps: First, check if the last digit of the given number is 7. If it is, the number is a Buzz number. If not, proceed to the next step, which is determining if the number is divisible by 7. To do so, simply divide the number by 7 and check if the remainder is 0. If the remainder is 0, the number is a Buzz number. If neither of these conditions is met, the number is not a Buzz number. This algorithm can be easily applied programmatically using loops and conditional statements, making it an excellent exercise for beginner programmers to practice their skills.
//A buzz number is a number that is either divisble by 7 or has last digit as 7.
#include <iostream>
using namespace std;
int main()
{
  int n, t;
  cin >> t;
  while (t--)
  {
    cin >> n;
    if ((n % 7 == 0) || (n % 10 == 7))
      cout << n << " is a buzz number" << endl;
    else
      cout << n << " is not a buzz number" << endl;
  }
  return 0;
}

LANGUAGE:

DARK MODE: