#include <stdio.h> double average1 (int a,int b,int c){ double x; x=(a+b+c)/3; return x; } double average2 (int a,int b,int c,int d,int e){ double y; y=(a+b+c+d+e)/5; return y; } int main(){ printf("学号 科目一 科目二 科目三"); int a[5][4]; int i,j; double x1,x2,x3,x4,x5,y1,y2,y3; for(i=0;i<5;i++){ for(j=0;j<4;j++){ scanf("%d",&a[i][j]); } } x1=average1(a[0][1],a[0][2],a[0][3]); x2=average1(a[1][1],a[1][2],a[1][3]); x3=average1(a[2][1],a[2][2],a[2][3]); x4=average1(a[3][1],a[3][2],a[3][3]); x5=average1(a[4][1],a[4][2],a[4][3]); printf("他们的平均分:%lf %lf %lf %lf %lf",x1,x2,x3,x4,x5); y1=average2(a[0][1],a[1][1],a[2][1],a[3][1],a[4][1]); y2=average2(a[0][2],a[1][2],a[2][2],a[3][2],a[4][2]); y3=average2(a[0][3],a[1][3],a[2][3],a[3][3],a[4][3]); printf("科目平均分:科目一:%lf,科目二:%lf,科目三:%lf",y1,y2,y3); return 0; }