填空题
给定程序中,函数fun的功能是找出100至x(x≤999)之间各位上的数字之和为15的所有整数,然后输出;符合条件的整数个数作为函数值返回。
例如,当n值为500时,各位数字之和为15的整数有:159、168、177、186、195、249、258、267、276、285、294、339、348、357、366、375、384、393、429、438、447、456、465、474、483、492。共有26个。
请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。
注意:源程序存放在考生文件夹下的BLANK1.C中。
不得增行或删行,也不得更改程序的结构!
给定源程序如下。
#include<stdio.h>
int fun(int x)
{ int n,s1,s2,s3,t;
/**************found*************/
n=
1;
t=100;
/*************found**************/
while(t<=
2)
{ s1=t%10;s2=(t/10)%10;s3=t/100;
if(s1+s2+s3==15)
{printf(":=:%d":=:,t);
n++;
}
/**************found***************/
3;
}
return n;
}
main()
{ int x=-1;
while(x>999||x<0)
{printf("Please input(0<x<=999):");
scanf("%d"t,&x);}
prinrf("/nThe result is:%d/n",fun(x));
}