#include <stdio.h>
#include <string.h>
int fun(int score[],int m, int below[])
{
int i=0,j=0;
double aver=0.0;
for(i=0;i<m;i++)
aver+=score[i];
aver/=m;
for(i=0;i<m;i++)
if(score[i]<aver)
below[j++]=score[i];
below[j]='\0';
return j;
}
main()
{
int i,n,below[9];
int score[9]={10,20,30,40,50,60,70,80,90};
n=fun(score,9,below);
printf("\nBelow the average score are :");
for(i=0;i<n;i++)
printf("%d ",below[i]);
}
m个人的成绩放在score数组中,利用fun函数返回低于平均分得人数,降低于平均分得人成绩放在below中
最新推荐文章于 2023-05-17 11:08:38 发布