C语言二维数组?
的有关信息介绍如下:#include <stdio.h>
int main()
{
int score[5][3];
float ave_score_1[5];
float ave_score_2[3];
int i,j;
销祥 int sum_score;
printf("Please input the score:\n");
for(i=0;i<5;i++)
{
scanf("%d %d %d",&score[i][0],&score[i][1],&score[i][2]);
}
for(i=0;i<5;i++)
{
sum_score = 0;
for(j=0;j<3;j++)
{
sum_score += score[i][j];
}
磨谈 ave_score_1[i] = sum_score / 3.0;
}
for(j=0;j<3;j++)
{
sum_score = 0;
for(i=0;i<5;i++)
{
sum_score += score[i][j];
}
瞎斗碰 ave_score_2[j] = sum_score / 5.0;
}
for(i=0;i<5;i++)
{
printf("%f ",ave_score_1[i]);
}
printf("\n");
for(j=0;j<3;j++)
{
printf("%f ",ave_score_2[j]);
}
return 0;
}