#include <stdio.h>
int armstrong(int n) {
int result = 0, remainder;
while(n > 0) {
remainder = n % 10;
n = n / 10;
result += remainder * remainder * remainder;
}
return result;
}
int main(void) {
// 153 = 1*1*1 + 5*5*5 + 3*3*3 = 153 = armstrong
for(int i = 1; i <= 500; i++)
if (i == armstrong(i))
printf("%d\n", i);
return 0;
}
/*
run:
1
153
370
371
407
*/