Computer Science, asked by akshayegreat, 1 year ago

an example of buzz number program blue j

Answers

Answered by Anonymous
4
A buzz number is one which is either divisible by 7 or ends with 7.
PROGRAM:-

import java.io.*;
class buzz
{
  public static void main()throws IOException
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter a number of your choice:-");
    int n=Integer.parseInt(br.readLine());
    int r,d
    if(n%7==0)
    {
      System.out.println("This is a BUZZ number.");
    }
    r=n%10;
    if(r==7)
    {
      System.out.println("This is a BUZZ number.");
    }
    else
    {
      System.out.println("This is NOT a BUZZ number.");
    }
  }
}
Answered by Anonymous
2

import java.util.*;

class buzz_number

{

   public void main()

   {

       Scanner sc=new Scanner(System.in);

       System.out.println("Enter a number to check to check whether it is buzz number or not");

       int n=sc.nextInt();

       int d=n%10;

       if(n%7==0||d==7)

       {

           System.out.println(n+" is a buzz number");

       }

       else

       {

           System.out.println(n+" is not a buzz number");

       }

   }

}

Similar questions