#include <stdio.h> int main() { int n = 0;//行 int m = 0;//列 scanf("%d %d", &n, &m);//输入 int arr1[n][m]; int i = 0; for (i = 0; i < n; i++)//遍历输入 { int j = 0; for (j = 0; j < m; j++) { scanf("%d ", &arr1[i][j]); } } int arr2[m][n]; for (i = 0; i < n; i++)//转置 { int j = 0; for (j = 0; j < m; j++) { arr2[j][i]=arr1[i][j]; } } for (i = 0; i < m; i++)//打印输出 { int j = 0; for (j = 0; j < n; j++) { printf("%d ", arr2[i][j]); } printf("\n"); } return 0; }