AUTOMORPHIC NUMBER
import java.util.Scanner;
class Automorphic_number
{
public static void main(String args[])
{
Scanner s= new Scanner(System.in);
int n,p,f=0;
System.out.println(" Enter a number ");
n=s.nextInt();
p=n*n;
do
{
if(n%10!=p%10)
{
f=1;
break;
}
else
{
n=n/10;
p/=10;
}
}
while(n>0);
if(f==0)
System.out.println("Automorphic number");
else
System.out.println(" Not an Automorphic number");
}
}
import java.util.Scanner;
class Automorphic_number
{
public static void main(String args[])
{
Scanner s= new Scanner(System.in);
int n,p,f=0;
System.out.println(" Enter a number ");
n=s.nextInt();
p=n*n;
do
{
if(n%10!=p%10)
{
f=1;
break;
}
else
{
n=n/10;
p/=10;
}
}
while(n>0);
if(f==0)
System.out.println("Automorphic number");
else
System.out.println(" Not an Automorphic number");
}
}