我要输出100-999内的水仙花数,但是407不知道为什么总是输不出其它三个就可以好奇怪
程序代码:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int action(int);
int i;
i=100;
printf("三位数水仙花数为\n");
while(i<=999)
{
action(i);
i++;
}
system("pause");
return 0;
}
int action(int n)
{
int hp,de,tu;
hp=n/100;
de=(n-100*hp)/10;
tu=n-100*hp-10*de;
if (n==pow(hp,3)+pow(de,3)+pow(tu,3))
printf("%d\n",n);
}
我这里是可以的
我的是dev-c++4.9.9.1我的是win8.1装不上vc6
本回答被提问者采纳