题目: 100-999的水仙花数 源代码: #include<stdio.h> int main() { //100-999的水仙花数 int a, b, c; int x; int sum = 0; for (x = 100; x < 1000; x++) { a = x / 100; b = x % 100 / 10; c = x % 100 % 10; sum = a * a * a + b * b * b + c * c * c; if (sum == x) { printf("水仙花数为:%d\n", sum); } } return 0; } 运行结果图: