forked from pn8rjlxip/System
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
342 B
17 lines
342 B
2 years ago
|
void AverSumofEveryStudent(STU stu[], int n, int m)
|
||
|
{
|
||
|
int i, j;
|
||
|
for (i=0; i<n; i++)
|
||
|
{
|
||
|
stu[i].sum = 0;
|
||
|
for (j=0; j<m; j++)
|
||
|
{
|
||
|
stu[i].sum = stu[i].sum + stu[i].score[j];
|
||
|
}
|
||
|
stu[i].aver = m>0 ? stu[i].sum / m : -1;
|
||
|
printf("student %d: sum = %.0f, aver = %.0f\n",
|
||
|
i+1, stu[i].sum, stu[i].aver);
|
||
|
}
|
||
|
}
|
||
|
|