7-3计算平均成绩

输入
5
00001 zhang 70
00002 wang 80
00003 qian 90
10001 li 100
21987 chen 60
输出
80.00
zhang 00001
chen 21987


#include
struct Student{
char id[10];
char name[10];
int score;
};
int main(){
int n,i;
struct Student student[10];
int sum=0,avg;
scanf("%d",&n);
for(i=0;i scanf("%s %s %d",&student[i].id,&student[i].name,&student[i].score);
sum=sum+student[i].score;
}
avg=sum/n;
printf("%d\n",avg);
for(i=0;i if(student[i].score printf("%s %s",student[i].id,student[i].name);
}
}
return 0;
}

你可能感兴趣的:(7-3计算平均成绩)