发布网友 发布时间:2022-04-23 08:55
共1个回答
热心网友 时间:2023-10-08 23:21
#include<stdio.h>
int main()
{
int a[5][5]={{65,98,98,78,4},{12,6,5,9,5},{56,,8,78,6},{132,12,84,48,7},{12,,23,197,8}};
float average(int a[5][5]);
float single(int a[5][5]);
average(a);
single(a);
return 0;
}
float average(int a[5][5])
{
int i,j,sum=0;
float aver;
for(i=0;i<5;i++)
{
sum=0;
for(j=0;j<5;j++)
{
sum=sum+a[i][j];
aver=sum/5.;
}
printf("NO %d student's number is %f\n",i+1,aver);
}
return 0;
}
float single(int a[5][5])
{
int i,j,sum;
float aver;
for(j=0;j<5;j++)
{
sum=0;
for(i=0;i<5;i++)
{
sum=sum+a[i][j];
aver=sum/5.;
}
printf("NO %d course number is %f\n",j+1,aver);
}
return 0;
}