Computer Science, asked by Sonam6190, 10 months ago

Write a java program to check whether given number is magic number or not.​

Answers

Answered by OfficialAditya
1

It is the program for checking a no . is magic no.

or not

Attachments:
Answered by Puneeth1235
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