Buzz Number Program in Java

Buzz Number Program in Java
Buzz Number Program in Java

A number is said to be Buzz Number if it ends with 7 or is divisible by 7.

Example: 1007 is a Buzz Number.


import java.util.Scanner;
public class BuzzNumber
{
    public static void main(String[] args)
    {
        int n;
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter n=");
        n = sc.nextInt();
        if (n % 10 == 7 || n % 7 == 0)
        {
            System.out.println("Buzz number");
        }
        else
        {
            System.out.println("Not Buzz number");
        }
    }
}

Output:

Enter n=147
Buzz number
b. tech. bca icse java java tutorials learn java mca programs

Frequently Asked Questions

A number is said to be Buzz Number if it ends with 7 or is divisible by 7. Example: 1007 is a Buzz Number.
A number is said to be Buzz Number if it ends with 7 or is divisible by 7. Example: 1007 is a Buzz Number.
Recent Posts