Buzz Number in Java: Definition, Rules, Examples, and Practice Problems

Learn what a Buzz Number is in number theory and Java programming. Understand its rules, examples, and how to check Buzz Numbers using Java. Includes sample program, table of examples, and 3 practice challenges.

Buzz Number in Java: Definition, Rules, Examples, and Practice Problems

A Buzz Number is a special type of number in number theory that is either divisible by 7 or ends with the digit 7. These numbers are frequently used in coding challenges and logical reasoning questions in interviews.

What Is a Buzz Number?

A number is considered a Buzz Number if it satisfies at least one of the following conditions:

For example:

Why Is It Called a Buzz Number?

The name comes from the simple rule-based classification: if the number “buzzes” by satisfying either condition, it is called a Buzz Number. It's a quick and fun classification commonly used in school and competitive programming.

Java Program to Check Buzz Number

Below is the Java program that checks whether a given number is a Buzz Number:


import java.util.Scanner;

public class BuzzNumber {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a number: ");
        int num = sc.nextInt();

        if (num % 7 == 0 || num % 10 == 7) {
            System.out.println(num + " is a Buzz Number");
        } else {
            System.out.println(num + " is NOT a Buzz Number");
        }
    }
}

Examples

Number Divisible by 7 Ends with 7 Buzz Number?
14 Yes No Yes
27 No Yes Yes
49 Yes No Yes
17 No Yes Yes
19 No No No

3 Practice Challenges

Challenge 1: Simple Check

Write a Java program to check whether a number is a Buzz Number without using the modulo (%) operator.

View Solution: Buzz Number Without Modulo Operator

Challenge 2: Count Buzz Numbers

Given an array of integers, count how many of them are Buzz Numbers.

Challenge 3: Range Finder

Write a Java program that prints all Buzz Numbers between 1 and 1000.