#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int num,t_num,s,digit;
for(num = 100; num <= 999; num++){
t_num=num;
s = 0;
do{
digit = t_num % 10;
s=pow(digit,3)+s;
t_num = t_num/10;
}while(t_num!=0);
if(s==num){
printf("%d\n", num);
}
}
return 0;
}
统计100-999内的水仙花数
最新推荐文章于 2022-03-26 16:10:08 发布