Programming Examples

Java program to check number is buzz number or not


Write a Java program to input a number form user and check whether number is buzz number or not.

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

Solution

import java.util.*;
class Buzz
{
    public static void main(String arr[])
    {
        Scanner sc=new Scanner(System.in);
        int num;
        System.out.println("Enter any Number : ");
        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");            
        }
    }
}
Output

Enter any Number : 

14

14 is a Buzz Number

------------------------------------------------------------

Enter any Number : 

77

77 is a Buzz Number

---------------------------------

Enter any Number : 

10

10 is not a Buzz Number


CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz