#include <stdio.h>
typedef struct{
int mth; //数学
int eng; //英語
int phy; //物理
int avg; //平均点
} Score;
void calcAverage(Score s[], int n);
int main(void) {
Score s[] = {
/* 構造体配列を初期化しなさい */
{65,80,95,0},
{70,68,75,0},
{60,100,83,0},
{100,55,74,0},
{90,85,74,0},
};
int i, n=5;
calcAverage(s, n);
for(i=0; i<n; i++ )
printf( "[%d] %4d %4d %4d %4d\n", i
, s
[i
].
mth, s
[i
].
eng, s
[i
].
phy, s
[i
].
avg );
return 0;
}
void calcAverage(Score s[], int n){
/* 関数を定義しなさい */
int i;
for(i=0;i<n;i++)
s[i].avg=(s[i].mth+s[i].eng+s[i].phy)/3;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp0eXBlZGVmIHN0cnVjdHsKCWludCBtdGg7IC8v5pWw5a2mCglpbnQgZW5nOyAvL+iLseiqngoJaW50IHBoeTsgLy/niannkIYKCWludCBhdmc7IC8v5bmz5Z2H54K5Cn0gU2NvcmU7IAoKdm9pZCBjYWxjQXZlcmFnZShTY29yZSBzW10sIGludCBuKTsKCmludCBtYWluKHZvaWQpIHsKCVNjb3JlIHNbXSA9IHsKCgkJLyog5qeL6YCg5L2T6YWN5YiX44KS5Yid5pyf5YyW44GX44Gq44GV44GE44CAKi8gCgl7NjUsODAsOTUsMH0sCgl7NzAsNjgsNzUsMH0sCgl7NjAsMTAwLDgzLDB9LAoJezEwMCw1NSw3NCwwfSwKCXs5MCw4NSw3NCwwfSwKfTsKCWludCBpLCBuPTU7CgoJY2FsY0F2ZXJhZ2Uocywgbik7CgoJZm9yKGk9MDsgaTxuOyBpKysgKQoJCXByaW50ZiggIlslZF0gJTRkICU0ZCAlNGQgJTRkXG4iLCBpLCBzW2ldLm10aCwgc1tpXS5lbmcsIHNbaV0ucGh5LCBzW2ldLmF2ZyApOwoKCXJldHVybiAwOwp9Cgp2b2lkIGNhbGNBdmVyYWdlKFNjb3JlIHNbXSwgaW50IG4pewoKCS8qIOmWouaVsOOCkuWumue+qeOBl+OBquOBleOBhCAqLwoJaW50IGk7Cglmb3IoaT0wO2k8bjtpKyspCgkJc1tpXS5hdmc9KHNbaV0ubXRoK3NbaV0uZW5nK3NbaV0ucGh5KS8zOwp9Cg==