
编写函数fun,函数原型为:int fun(int score[],int m,int below[])。它的功能是 30
编写函数fun,函数原型为:intfun(intscore[],intm,intbelow[])。它的功能是:m个人的成绩存放在score数组中,将低于平均分的人数作为函...
编写函数fun,函数原型为:int fun(int score[],int m,int below[])。它的功能是:m个人的成绩存放在score数组中,将低于平均分的人数作为函数返回,将低于平均分的分数放在below所指的数组中。最后附上运行结果截图,感谢🙏
展开
1个回答
展开全部
int fun(int score[],int m,int below[])
{
int sum = 0;
int aver = 0;
int count = 0;
for(int i = 0; i < m; i++)
{
sum += score[i];
}
aver = sum / m;
for(int j = 0; j < m; j++)
{
if(score[j] < aver)
{
below[count] = score[j];
count++;
}
}
return count;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询