作者:Resolve | 来源:互联网 | 2023-10-14 16:03
#include
int fun(int k,float *aver,float *grade)
{
double sum=0.0;
int count=0;
for(int i=0;i sum+=grade[i];
*aver=sum/k;
for(int j=0;j if(grade[j]<*aver)
count++;
return count;
}
void main()
{
int k,i;
float grade[81],aver;
printf("please input student_num:");
scanf("%d",&k);
for(i=0;i {
printf("输入第%d位学生成绩:",i+1);
scanf("%f",grade+i);
}
printf("低于平均分的学生人数是:%d\n",fun(k,&aver,grade));
}