An Armstrong number (narcissistic number) here is a 3-digit number where the cubes of its three digits add up to the number itself. For example, 153 = 1³ + 5³ + 3³. Show all of them from smallest to largest, one per line. In the starter, a, b, c are the hundreds, tens and ones digits.
153 370 371 407
#include <stdio.h>
int main(void) {
for (int n = 100; n <= 999; n++) {
int a = n / 100;
int b = n / 10 % 10;
int c = n % 10;
// your code here: if the sum of the three cubes equals n, show n
}
return 0;
}
Run tries the examples. When they look right, Submit.