write a program to check whether number is magic number or not in java with if statement
Answers
Answered by
0
Explanation:
a=float(input("value of a"))
square=a*a
if product<0;
print(a is a magic number)
elseif product>0;
print(a is not a magic number)
else product=0;
print(a is exactly equal to zero)
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