Write a java program to check whether given number is magic number or not.
Answers
Answered by
1
It is the program for checking a no . is magic no.
or not
Attachments:
Answered by
3
Answer:
import java.util.Scanner;
class MagicNum
{
public static void main()
{
Scanner in=new Scanner(System.in);
int n;
System.out.println("Enter a number");
n=in.nextInt();
if(n%9==1)
System.out.println("Magic Number");
else
System.out.println("Not a Magic Number");
}
}
Explanation:
Similar questions