填空题
下列给定程序中,请补充函数proc(),该函数的功能是:输出数组元素中小于平均值的元素。在主函数main()中,从键盘输入若干个数放入数组str中,并以0结束输入但不计入数组。
例如,数组中元素的值依次为2 3 4 5 5,则程序的运行结果为2,3。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdlib.h>
#include<conio.h>
#include<stclio.h>
void proc(
1, int n)
{
double sum=0.0;
double average=0.0;
int i=0;
for(i=0; i<n; i++)
2;
average=
3;
for(i=0; i<n; i++)
if(x[i]<average)
{
if(i%5==0)
printf("/n");
printf("%d, ", x[i]);
}
}
void main()
{
int str[1000];
int i=0;
system("CLS");
printf("/nPlease enter some data(endwith 0):");
do
{
scanf("%d", &str[i]);
}
while(str[i++]!=0);
proc(str, i-1);
}