实验六
#include <stdio.h>
float averagestudent(int x,int y,int z)
{
float average;
average=(float)(x+y+z)/3;
return average;
}
float averagesoure(int a,int b,int c,int d,int e)
{
float average;
average=(float)(a+b+c+d+e)/5;
return average;
}
void main()
{
int i,j;
float average;
int a[5][3];
for(i=0;i<=4;i++)
{ for(j=0;j<=2;j++)
scanf("%d",a[i]+j);
}
printf("student averag: \n");
for(i=0;i<=4;i++)
{ average=averagestudent(a[i][0],a[i][1],a[i][2]);
printf("%f\n",average);
}
printf("soure average: \n");
for(j=0;j<=2;j++)
{ average=averagesoure(a[0][j],a[1][j],a[2][j],a[3][j],a[4][j]);
printf("%f\n",average);
}
}