How to check if a number is Automorphic or not !!! using C language !!

 #include <stdio.h>

#include <math.h>

#include <ctype.h>


void main() {

    int m,n,square_n,temp,i,j,nn;

    scanf("%d",&n);

    

    square_n = pow(n,2);

    m = ceil(log10(n));

temp = square_n;

for(i=1;i<=m;i++){

j = pow(10,i);

nn = temp % j;

if(n == nn){

printf("%d is a Automorphic",n);

break;

}

if(n != nn){

printf("%d is not an Automorphic",n);

}

}

 

Comments