//打印出所有的水仙花数例:153=1*1*1+5*5*5+3*3*3 #include<iostream> using namespace std; int main() { cout << "水仙花数有:"; for (int i = 100; i < 1000; i++) { int a = i % 10; int b = ((i-a)/10)%10; int c = i/ 100; if (i == a*a*a + b*b*b + c*c*c) { cout << i << " "; } } return 0; }