其实是你的数组没有初始化的结果,
还有z也可以不用了!
#include <stdio.h>
#include <stdlib.h>
main()
{
int x=0,y=0;
int a[3][4]={0},b[3]={0};
printf("请输入三个班的学生\n");
for(x=0;x<3;x++)
{for(y=0;y<4;y++)
{scanf("%d",&a[x][y]);
b[x]=b[x]+a[x][y];
}
printf("%d",b[x]);
printf("\n");
}
b[0]=b[0]/4;
b[1]=b[1]/4;
b[2]=b[2]/4;
printf("%5d",b[0]);
printf("%5d",b[1]);
printf("%5d",b[2]);
system("pause");
}