*****scanf("&d", &a[n][m]);此语句有误,应为scanf("%d",&a[n][m]);而错误语句致使输入的数据没有被存入数组中,所以读出的数与预订不服和
#include
#define N 3
void main(){
int n,m;
int s;
int a[N][N];
printf("请输入方振:\n");
for(n=0;n for(m=0;m scanf("%d",&a[n][m]); for(n=0;n for(m=0;m printf("%d ",a[n][m]); printf("\n"); } s=0; for(n=0,m=0;n s+=a[n][m]; printf("%d\n",s); s=0; for(n=0,m=N-1;n s+=a[n][m]; printf("%d",s); } 输出结果:
#include
#define N 3
void main(){
int n,m;
int s;
int a[N][N];
for(n=0;n for(m=0;m scanf("%d",&a[n][m]); } } for(n=0;n for(m=0;m printf("%d ",a[n][m]); } printf("\n"); } } 没问题呀!!!不知道怎么回事,注释掉然后测试一下上面代码有错没得嘛
scanf("%d", &a[n][m]);
scanf("%d",&a[n][m]),是%d的,你写错了
scanf("%d", &a[n][m]);而不是&d