main()
{ int n,k;float score,ave;
ave=0.0;
for(n=1;n<=10;n++)
{ for(k=1;k<=4;k++)
{ scanf(“%f”,&score);
ave+=score/4 ;}
printf(“NO%d:%f\n”,n,ave);}
}
main()
{ int n,k;float score,ave;
ave=0.0;
for(n=1;n<=10;n++)
{ for(k=1;k<=4;k++)
{ scanf(“%f”,&score);
ave+=score/4 ;}
printf(“NO%d:%f\n”,n,ave);}
}
错在你计算每个学生成绩平均值的时候
没有把ave清零
#include <stdio.h>
void main()
{
int n,k;float score, ave;
for(n=1;n<=10;n++)
{
ave=0.0;
for(k=1;k<=4;k++)
{
scanf("%f",&score);
ave+=score/4;
}
printf("NO%d: %f\n",n,ave);}
}
没问题啊,我试过了,没问题