例2 输入某班30位学生的姓名及数学、英语成绩, 计算并输出每门课程的平均分 void maino i struct student s301 float aver m=0. aver e=0
输入某班30位学生的姓名及数学、英语成绩, 计算并输出每门课程的平均分。 void main( ) { struct student s[30]; int i; float aver_m=0, aver_e=0; 例2
for(i=0,i30;计+){ scanf("%oS%d%d",sl] name, &si. math, &s1]. eng) aver m +=si. math aver e+=s1.eng, printf("%f%f, aver m/30, aver e/30)
for(i=0; i<30; i++) { scanf("%s%d%d", s[i].name, &s[i].math, &s[i].eng); aver_m += s[i].math; aver_e += s[i].eng; } printf("%f%f", aver_m/30, aver_e/30); }