题解 | 矩阵转置
矩阵转置
https://www.nowcoder.com/practice/351b3d03e410496ab5a407b7ca3fd841
#include <stdio.h>
int main() {
int n,m;
scanf("%d %d",&n,&m);
int np[m][n];
int a;
int b;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
scanf("%d",&a);
np[j][i]=a;
}
}
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
b=np[i][j];
printf("%d ",b);
}
printf("\n");
}
return 0;
}
