描述:
阿姆斯特朗数又称水仙花数,是指一种三位数,其各个数字之立方和等于该数。
Armstrong number which is also called Daffodils number is a three-figure number,and the sum of the number of it’s respective positions equals itself.
For example 153 = 1*1*1 + 5*5*5 + 3*3*3
#include<iostream>
using namespace std;
int main() {
int i,j,a,b,c;
int n, m;
for (i = 100; i <= 999; i++) {
a = i % 10;
b = i / 10 % 10;
c = i / 100 % 10;
if (a*a*a + b * b*b + c * c*c == i)
cout << i << endl;
}
return 0;
}