#include <stdio.h>
#include <math.h>
int main()
{
int i = 100;
int a,b,c;
while (i<1000)
{
a = i % 10;
b = i / 10 % 10;
c = i / 10 / 10 % 10;
if (i == pow(a, 3) + pow(b, 3) + pow(c, 3))
{
printf("%d\n", i);
}
i++;
}
return 0;
}
c语言用while循环来寻找1-1000中的全部水仙花数
最新推荐文章于 2023-03-31 15:07:54 发布