Write a program to input a number and check whether it is an Automorphic
number or not. An automorphic number is that which is present at the last
of its square. For example, 25 is an automorphic number as it is present in
its square i.e. 625.
Answers
Answered by
0
Answer:
#include <studio.h>
int main()
{
int a, b;
scanf("%d",&a);
b=a*a;
while(a!=0)
{
if(a%10==b%10)
{
a=a/10;
b=b/10;
}
else
break;
}
if(a!=0)
printf("%d is an Automorphic number", a);
else
printf("%d is not an Automorphic number", a);
return 0;
}
Result:
Input : 25
Output : 25 is an Automorphic number
Similar questions