#include <stdio.h>
int main(void)
{
int m, n = 0, k, sum;
for (k = 100; k < 1000; ++k)
{
m = 153;
do
{
sum = m % 10;
n = n + sum * sum * sum;
m = m / 10;
} while (m);
if( k == n)
printf("%d\n", k );
break;
n = 0;
}
return 0;
}
代码如下