#include <stdio.h>
#define DATANUM 5
int main(){
typedef struct Seiseki{
int eigo;
int kokugo;
int sugaku;
float average;
} SEISEKI;
SEISEKI score[DATANUM];
int i;
float eigosum=0;
float kokugosum=0;
float sugakusum=0;
/* 英語と国語と数学の点数を DATANUM 個読み込み、3科目の平均値を計算する */
for (i=0;i<DATANUM;i++){
scanf("%d",&(score
[i
].
eigo)); scanf("%d",&(score
[i
].
kokugo)); scanf("%d",&(score
[i
].
sugaku)); score[i].average = ((score[i].eigo) + (score[i].kokugo) + (score[i].sugaku))/3;
}
/* 3科目の平均値を表示する */
for (i=0;i<DATANUM;i++){
printf("%d 人目の人の3 科目平均は%3.1f です。\n",i
+1, score
[i
].
average); }
/*英語と国語と数学の平均値をそれぞれ表示する*/
for (i=0;i<DATANUM;i++){
eigosum+=score[i].eigo;
kokugosum+=score[i].kokugo;
sugakusum+=score[i].sugaku;
}
printf("英語の平均点は %3.1f 点です。\n", eigosum
/ 5); printf("国語の平均点は %3.1f 点です。\n", kokugosum
/ 5); printf("数学の平均点は %3.1f 点です。\n", sugakusum
/ 5); }
I2luY2x1ZGUgPHN0ZGlvLmg+CiNkZWZpbmUgREFUQU5VTSA1CgppbnQgbWFpbigpewoJCgl0eXBlZGVmIHN0cnVjdCBTZWlzZWtpewoJCWludCBlaWdvOwoJCWludCBrb2t1Z287CgkJaW50IHN1Z2FrdTsKCQlmbG9hdCBhdmVyYWdlOwoJfSBTRUlTRUtJOwoJU0VJU0VLSSBzY29yZVtEQVRBTlVNXTsKCWludCBpOwoJZmxvYXQgZWlnb3N1bT0wOwoJZmxvYXQga29rdWdvc3VtPTA7CglmbG9hdCBzdWdha3VzdW09MDsKCQoJLyog6Iux6Kqe44Go5Zu96Kqe44Go5pWw5a2m44Gu54K55pWw44KSIERBVEFOVU0g5YCL6Kqt44G/6L6844G/44CBM+enkeebruOBruW5s+Wdh+WApOOCkuioiOeul+OBmeOCiyAqLwoJZm9yIChpPTA7aTxEQVRBTlVNO2krKyl7CgkJc2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