#include <
stdio.h>
int main(void)
{
//把data.txt放在同一个
文件夹里面
freopen("data.txt", "r", stdin);
int i, j;
double score[3] = {0.0}; //三科最高分
double avg[3] = {0.0}; //三科均分
for (i = 0; i < 20; i++)
{
for (j = 0; j < 3; j++)
{
double index;
scanf("%lf", &index);
if (index > score[j])
score[j] = index;
avg[j] += index;
}
}
for (j = 0; j < 3; j++)
avg[j] /= 20;
for (j = 0; j < 3; j++)
{
printf("第%d科, 最高分: %.2f\t 平均分: %.2f\n", j, score[j], avg[j]);
}
return 0;
}
//数据:
/*
22.00 97.00 15.00
82.00 42.00 12.00
80.00 35.00 25.00
35.00 4.00 16.00
17.00 26.00 64.00
35.00 87.00 63.00
9.00 18.00 86.00
24.00 89.00 8.00
47.00 41.00 4.00
99.00 83.00 16.00
57.00 5.00 65.00
73.00 39.00 59.00
37.00 20.00 47.00
14.00 55.00 3.00
83.00 24.00 29.00
99.00 60.00 69.00
62.00 21.00 87.00
0.00 97.00 28.00
9.00 44.00 69.00
13.00 95.00 52.00
*/