该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
void input(float score[10][5]);
void average(float aver[]);
void course(float cour[]);
float score[10][5],aver[10],cour[5];
int i,j;
void main()
{
printf("please input the scores of all the students\n");
input(score);
average(aver);
course(cour);
}
void input(float score[10][5])
{
for (i=0;i<10;i++)
{
printf("the scores of NO.%d student are:\n",i+1);
for (j=0;j<5;j++)
scanf("%f",&score[i][j]);
}
}
void average(float aver[10])
{
float total[10]={0};
for (i=0;i<10;i++)
{
for (j=0;j<5;j++)
total[i]+=score[i][j];
aver[i]=total[i]/5.0;
printf("\n NO.%d student's average score is: %f\n",i+1,aver[i]);
}
}
void course(float cour[5])
{
float total[5]={0};
for (j=0;j<5;j++)
{
for (i=0;i<10;i++)
total[j]+=score[i][j];
cour[j]=total[j]/10.0;
printf("\n the average of course %d is: %f\n",j+1,cour[j]);
}
}