write a program in Java to input number and check if the number is a buzz number or not
Answers
Answer:
A number is said to be Buzz Number if it ends with 7 or is divisible by 7.
Explanation:
The code is as follows:
import java.util.*;
public class BuzzNumberCheck
{
public static void main(String args[])
{
Scanner ob=new Scanner(System.in);
System.out.println("Enter the number to be checked.");
int num=ob.nextInt();
if(num%10==7 || num%7==0)
{
System.out.println(num+" is a Buzz Number.");
}
else
{
System.out.println(num+" is not a Buzz Number.");
}
}
}
#answerwithquality & #BAL
import java. util. *
class Buzz
{
public static void main (string args[])
{
Scanner sc= new Scanner (System. in);
int x;
System.out.println ("Enter a number");
x=sc. nextInt ();
if(x%==0||x/10==7)
System.out.println (x+"is Buzz number");
else
System.out.println (x+"is not Buzz");
}
}