#include <iostream>
using namespace std;
//水仙花数是指一个三位数,它的每个位上的数字的3次幂之和等于它本身
//用do...while语句
int main()
{
int num1 = 100;
do
{
int a = 0;
int b = 0;
int c = 0;
a = num1 % 10;
b = num1 / 10 % 10;
c = num1 / 100;
if(a* a* a + b * b * b + c * c * c == num1)
cout << num1 << endl;
num1++;
}
while (num1 < 1000);
system("pause");
return 0;
}
02-20
237
11-13
450
11-19
06-01