#include<iostream>
using namespace std;
int main()
{
int num = 100;
do
{
int a = num % 10;
int b = (num / 10) % 10;
int c = num / 100;
if (a*a*a + b*b*b + c*c*c == num)
{
cout << num << endl;
}
num++;
}
while (num < 1000);
system("pause");
return 0;
}
输出100-1000之间的水仙花数,水仙花数就是个位的三次方、十位的三次方、百位的三次方之和等于该数