关于#c语言#的问题:计算每门课程的平均成绩相关代码运行结果不对用devc++编辑

计算每门课程的平均成绩相关代码运行结果不对

img


用devc++编辑

#include <stdio.h>
typedef struct _stu
{
    int id;
    float s[3];
}student;
int main()
{
    student stu;
    float total[3] = {0};
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d %f %f %f",&stu.id,&stu.s[0],&stu.s[1],&stu.s[2]);
        total[0] += stu.s[0];
        total[1] += stu.s[1];
        total[2] += stu.s[2];
    }
    for(int i=0;i<3;i++)
        printf("%.1f\n",total[i]/n);
}