给定程序的功能是计算score中m个人的平均成绩aver,将低于aver的成绩放在below中,通过函数名返回人数。
例如,当score=(10,20,30,40,50,60,70,80,90),m=9时,函数返回的人数应该是4,below=10,20,30,40)。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容,仅在横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<string.h>
int fun(int score[],int m,int below[])
int i,j=0;
float aver=0.0:
for(i=0;i<m;i++)
aver+=score[i]:
aver/=(float)m;
n=fun(score,9, (2) );
printf("\n Below the average score are:%d\n",n);
for(i=0;i<n;i++)
for(i=0;i<m;i++)
if(score[i]~aver)
below[j++]= (1) ;
return j;
void main()
int i,n,below[9];
int score[9]=10,20,30,40,50,60,70,80,90);
printf("%d", (3) );
参考答案:below