Computer Science, asked by chocolatebrain, 1 year ago

IT IS URGENT.I HAVE A TEST TOMORROW ON THIS.how to check whether a given number is automorphic or not using java for loop.

Answers

Answered by anirbanroy
1
import java.util.Scanner;
class Automorphic
{
public static void main()
{
Scanner sc=new Scanner(System.in);
int n,t,sq,c=1;
System.out.println("Enter a number");
n=sc.nextInt();
t=n;
sq=n*n;
while(t>0)
{
c=c*10;
t=t/10;
}
if(sq%c==n)
System.out.println("Automorphic");
else
System.out.println("Not Automorphic");
}
}

chocolatebrain: too late
Similar questions