program to caluclate automerphic number(using java)
// if a number is present at the end of its square
ex- 25 sqr=625 (25 is present at the end of 625)
class automerphic
{
public static void main(String args[])
{
int no=125, sqr=0,b=0,c=0,e=0;
sqr=no* no;
while(no>0 && sqr>0)
{
b=n0%10;
no=no/10;
c=sqr%10;
sqr=sqr/10;
if( b !=c)
{
e=1; // e is the marking symbol
break;
}}
if(e==0)
System.out.println("automerphic");
else
System.out.println("not auto merphic");
}
}
Advantageous...
ReplyDelete