习题2-1 水仙花数
#include<stdio.h> #include<math.h> int main() { int x; for (x = 100; x < 1000; x++) { int a = x / 100; int b = (x - a * 100) / 10; int c = x - a * 100 - b * 10; if (x == pow(a, 3) + pow(b, 3) + pow(c, 3)) { printf("%d\n", x); } } return 0; }
勿在浮沙筑高台