//(1)每个学生平均分;
//(2)每门课的平均分.
要用C语言来做```
挺有挑战性的```
不知哪位高手能做出来```?````恭候喜讯~~~~
//输入10个学生5门课的成绩,分别用函数求
//(1)每个学生平均分;
//(2)每门课的平均分.
#include <stdio.h>
#define ST 10
#define TC 5
int C_array[TC][ST];
void stu_each(void){
int i,j,sum;
for (i = 0;i < TC; ++i){
sum = 0;
for (j=0;j < ST; ++j){
sum +=C_array[i][j];
}
printf(" Student[%d] average is:%d\n",i,sum/ST);
}
}
void cou_each(void){
int i,j,sum;
for (i = 0;i < ST; ++i){
sum = 0;
for (j=0;j < TC; ++j){
sum +=C_array[j][i];
}
printf(" Course[%d] average is:%d\n",i,sum/TC);
}
}
int main(void){
int i,j;
for (i = 0;i < TC; ++i){
for (j=0;j < ST; ++j){
printf("Please Input Student[%d] Course[%d]:\n",i,j);
scanf("%d",&C_array[i][j]);
}
}
stu_each();
cou_each();
return 0;
}