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
What is 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.
Example: 1007 is a Buzz Number.
What is Buzz Number 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.
Example: 1007 is a Buzz Number.