Buzz Number Program in Java2 min read

In this tutorial, we will start with what is Buzz Number and Write a Java Program to check whether the number is Buzz Number or not.

Buzz Number

A Buzz number is one of the special number that ends with 7 or is divisible by 7.

For example: 7, 17, 27, 37, etc are buzz numbers because they end with 7 and the numbers 7, 14, 21, 28, etc are also buzz numbers because they are divisible by 7.

Program Approach to check the Buzz Number.

1. First take a number which need to be checked for Buzz.

2. We then apply a condition to check the two conditions needed to check for Buzz number.

  • We check if the last digit is 7 or not with % operator (number % 10 == 7), which gives us the remainder.
  • Then, we check the divisibility of a number by 7 with / operator (num / 7 == 0).

3. Both of these conditions are checked together in with || operator, in which if either one is true then || (or) operator returns a true value. Indicating the number is Buzz number.

4. Else the number is not a Buzz number.

Java Program to check whether the number is Buzz Number or not


Java program to display all the Buzz number in a given Range

This is another example where we will print all the Buzz number in a given range in Java.


You may create a separate boolean function to check for the Buzz number and return the number to the main function. Call the boolean function inside the for loop in the main function.


Java Program to check Krishnamurthy Number

In this tutorial, we will learn about Krishnamurthy numbers and write a Krishnamurthy Number program in Java. We will write two programs for Krishnamurthy number …
Read More

Java Program for ISBN Number

In this tutorial, we will learn about the ISBN (International Standard Book Number) and write a program to check for the ISBN Number in Java …
Read More

C++ Memory Management

Memory management refers to the process of managing the computer memory while assigning the space to the program’s variable to improve the overall performance. Requirement …
Read More

C++ Pointer to Pointer

As we know by now that a pointer stores the address of the pointed variable. But it is not the only use, pointer also stores …
Read More

C++ Passing Pointers to Functions

A function is a user-defined block of codes that executes some specific task assigned to it invoked by its name. If there is an argument …
Read More

C++ Null Pointer

We use a null pointer when we do not have the exact address to assign to a pointer. It is considered a good practice and …
Read More