How to write a java menu driven program to check whether the given number is automorphic Or buzz number.
import java.util.Scanner;
class AutomorphBuzz
{
public static void main()
{
Scanner kb=new Scanner(System.in);
System.out.println(“Enter a number to check whether a number is an Automorphic or a Buzz number”);
int a=kb.nextInt();
System.out.println(“Enter 1 for Automorphic Number and Enter 2 for Buzz Number”);
int x=kb.nextInt();
int b=a*a;int c=b%100;int d=b%10;int e=a%7;int f=a%10;
if(x==1)
{ if(a<10)
{ if(d==a) System.out.println("The number is Automorphic");
else
System.out.println("The number is not Automorphic"); }
else
System.out.println();
if(b>100)
{ if(c==a) System.out.println("The number is a Automorphic number");
else
System.out.println("The number is not a Automorphic number"); if(b<100)
{ if(d==a) System.out.println("The number is a Automorphic number");
else
System.out.println("The number is not a Automorphic number");
}
}
}
else if(x==2)
{ String g=(e==0||f==7)?"The number is a Buzz number":"The number is not a Buzz number"; System.out.println(g); }
else
System.out.println("Invalid input"); }
}