該樓層疑似違規已被系統折疊 隐藏此樓檢視此樓
求平均成績的!!
#include
#define M 5
#define N 3
void main()
{
void average_score(float score[M][N],float average_s[M],float average_k[N]);
void Max_min(float score[M][N],float Max[N],float Min[N]);
int number[M];
float average_s[M];
float average_k[N];
float Max[N],Min[N];
float score[M][N];
int i,j;
printf("please input \n");
printf("學号 英語 高數 計算機 :\n");
for (i=0;i
{
scanf("%d",&number[i]);
for(j=0;j
scanf("%f",&score[i][j]);
}
for (i=0;i
average_s[i]=0;
for (i=0;i
{
Max[i]=0;
Min[i]=100;
average_k[i]=0;
}
average_score(score,average_s,average_k);
Max_min(score,Max,Min);
printf("學号 英語 高數 計算機 :\n");
for (i=0;i
{
printf("%d",number[i]);
for(j=0;j
printf("%8.1f",score[i][j]);
printf("%8.1f",average_s[i]);
printf("\n");
}
printf("平均:\n");
for (i=0;i
printf("%8.1f",average_k[i]);
printf("\n 最大值 最小值:\n");
for (i=0;i
printf("%8.1f %10.1f \n",Max[i],Min[i]);
}
void average_score(float score[M][N],float average_s[M],float average_k[N])
{
int i,j;
for(i=0;i
for(j=0;j
average_s[i]=average_s[i]+score[i][j]/N;
for (i=0;i
for(j=0;j
average_k[j]=average_k[j]+score[i][j]/M;
}
void Max_min(float score[M][N],float Max[N],float Min[N])
{
int i,j;
for (i=0;i
for(j=0;j
if(Max[j]
for(i=0;i
for(j=0;j
if(Min[j]>score[i][j]) Min[j]=score[i][j];
}