C语言程序填空

给定程序的功能是:求五位数各数字的立方和为1000的最小的五位数。请在程序的下划线处填入正确的内容并把下划线及带括号的编号删除, 使程序得出正确的结果为:x=13369。 注意:不得增行或删行,也不得更改程序的结构!
#include<stdio.h>
void main()
{ /**********found**********/
float x=___(1)____;
int a,b,c,d,e;
while (x<=99999)
{ /**********found**********/
____(2)______;
b=((int)(x)-a*10000)/1000;
c=((int)(x)-a*10000-b*1000)/100;
d=((int)(x)-a*10000-b*1000-c*100)/10;
e=(int)(x)%10;
/**********found**********/
if( _________(3)________________ )
{ printf("x=%.0f\n",x);
break;
}
x=x+1;
}
}

第1个回答  2019-05-29
#include<stdio.h>
void main()
{ /**********found**********/
float x = 10000;
int a, b, c, d, e;
while (x <= 99999)
{ /**********found**********/
a = (int)(x) / 10000;
b = ((int)(x)-a * 10000) / 1000;
c = ((int)(x)-a * 10000 - b * 1000) / 100;
d = ((int)(x)-a * 10000 - b * 1000 - c * 100) / 10;
e = (int)(x) % 10;
/**********found**********/
if (a*a*a + b*b*b + c*c*c + d*d*d + e*e*e == 1000)
{
printf("x=%.0f\n", x);
break;
}
x = x + 1;
}
}

本回答被提问者采纳
相似回答