计算每门课程的总分和平均分

pull/1/head
tong tong zhang 2 years ago
parent 939ab76382
commit 1465599078

@ -0,0 +1,18 @@
void AverSumofEveryCourse(STU stu[], int n, int m)
{
int i, j;
float sum[COURSE_NUM], aver[COURSE_NUM];
/* ---------- begain ---------- */
for (j=0; j<m; j++)
{
sum[j] = 0;
for (i=0; i<n; i++)
{
sum[j] += stu[i].score[j];
}
aver[j]=sum[j]/i;
printf("student %d: sum = %.0f, aver = %.0f\n",
j+1, sum[j], aver[j]);
}
/* ----------- end ----------- */
}
Loading…
Cancel
Save