Enter a natural number less than 1000 from the keyboard to determine whether it is an autologous number. An autologous number means that the mantissa of the square of a number is equal to its own natural number. For example, 25*25=625
is defined by the autologous number. The remainder of the square of a number divided by 10 or 100 or 1000 is the automorphic number itself. The
code is as follows:
#include <stdio.h>
void main(){
int num = 0,div=0;
printf("请输入自然数\n");
scanf("%d",&num);
if(num<10){
div = 10;
}else if(num < 100){
div = 100;
}else{
div =1000;
}
if(num * num % div == num){
printf("%d 是自守数\n",num);
}else{
printf("%d 不是自守数\n",num);
}
}