Wap in Java to insert five no and check it is a buzz no
Answers
Answered by
3
Hey There,
Here is the Code for the Program which will accept a number from the user, and check whether it is a Buzz Number or not.
To check if "5" is a Buzz Number, input 5 in the Program.
import java.util.Scanner;
public class BuzzNumber
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("A Buzz Number is a number which ends in 7 or which is divisible by 7.\n");
System.out.print("Enter the number: ");
int n = sc.nextInt();
if((n%7 == 0)||(n%10 == 7))
{
System.out.println(n+" is a Buzz Number");
}
else
{
System.out.println(n+" is not a Buzz Number");
}
}
}
Hope it helps
Purva
Brainly Community
Here is the Code for the Program which will accept a number from the user, and check whether it is a Buzz Number or not.
To check if "5" is a Buzz Number, input 5 in the Program.
import java.util.Scanner;
public class BuzzNumber
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("A Buzz Number is a number which ends in 7 or which is divisible by 7.\n");
System.out.print("Enter the number: ");
int n = sc.nextInt();
if((n%7 == 0)||(n%10 == 7))
{
System.out.println(n+" is a Buzz Number");
}
else
{
System.out.println(n+" is not a Buzz Number");
}
}
}
Hope it helps
Purva
Brainly Community
Answered by
2
- Write a program in Java to check whether a number is buzz number or not.
A number is said to be a buzz number if it is either divisible by 7 or the last digit is 7.
For example, 7 is a buzz number,14 ,21,37 and so on.
Here is the code,
import java.util.*;
class BuzzNumber
{
public static void main(String s[])
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter a number: ");
int n=sc.nextInt();
if(n%7==0||n%10==7)
System.out.println("Number is a Buzz Number.");
else
System.out.println("Number is not a Buzz Number.");
}
}
Similar questions