WAP to check whether a number is a buzz number or not
Answers
A buzz number is a number which has its last digit as 7 or is divisible by 7. Example- 1007,7777 etc.
Here is your program____
//Buzz__number.
import java.io.*;
class buzz
{
public static void main(String args
[]) throws IOException
{
BufferedReader br=new
BufferedReader (new
InputStreamReader(
System.in));
int n;
System.out.println("Enter a
number");
n=Integer.parseInt(br.readLine());
if(n%10==7 || n%7==0)
System.out.println("Buzz no");
else.
System.out.println("not buzz");
}
}
Answer:
import java.util.*;
class buzz
{
public static void main()
{
Scanner sc= new Scanner(System.in);
System.out.println("enter an integer");
int n =sc.nextInt();
if(n%7==0||n%10==7)
System.out.println("buzz number");
else
System.out.println("not");
}
}