main()
{ int M,N,i,j;
float score[10][10],sc[10][10],sum=0;
printf("inputs a numbers:\n");
scanf("%d%d",&M,&N);
printf("the stduents NO.=%d,the subjects NO.=%d",M,N);
printf("\n");
{for (i=0;i<M;i++)
for (j=0;j<N;j++)
scanf("%d",&scroe[i][j]);
}
{ for (i=0;i<M;i++)
for (j=0;j<N;j++)
sum+=score[i][j];
sc[5][j]=sum/N;
}
{ for (i=0;i<M;i++)
for (j=0;j<N;j++)
sum+=score[i][j];
sc[i]5]=sum/M;
}
printf("the students average =%.2f,the subjects average =%.2f",sc[5][j],sc[i][5]);
getch();
}
注:
{题目:求每个学生平均成绩和每门课的平均成绩;学生数为M个,有N门课程;(M=5,N=5)}
我不知道错在哪,每次运行时,结果却出现两个0.00,我实在是检查不出.
请各位学长们,帮我找一找,我在这先谢谢您们了!!