输出100-999中所有的水仙花数。
若三位数ABC满足ABC=AAA+BBB+CCC,则称其为水仙花数。例如153=111+555+333.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main()
{
int a, b, c;
for (a = 1; a <= 9; a++)
{
for (b = 0; b <= 9; b++)
{
for (c = 0; c <= 9; c++)
{
if (100 * a + 10 * b + c == a * a * a + b * b * b + c * c * c)
{
printf("%d\n", 100 * a + 10 * b + c);
}
}
}
}
return 0;
}