凌波仙子
水仙花
问题:
水仙花:一个数其各个位的数字立方和等于其本身
#include <stdio.h> #include <stdlib.h> #include<math.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 n; int i; int a, b, c; // scanf("%d", &n); for(i=100; i<1000; i++) { a = i%10; b = i/10%10; c = i/100; if(i == a*a*a+b*b*b+c*c*c) printf("%d\n", i); } return 0; } /* 153 370 371 407 */