#include <stdio.h> int main() { int i,j,i1,j1,a[101][101],b[101][101]; printf("please input the number of rows(<=100)n"); scanf("%d",&i1); printf("please input the number of columns(<=100)n"); scanf("%d",&j1); printf("please input the elementn"); for(i=0;i<i1;i++) for(j=0;j<j1;j++) scanf("%d",&a[i][j]); printf("array a:n"); for(i=0;i<i1;i++) { for(j=0;j<j1;j++) printf("t%d",a[i][j]); printf("n"); } for(i=0;i<i1;i++) for(j=0;j<j1;j++) b[j][i]=a[i][j]; printf("array b:n"); for(i=0;i<j1;i++) { for(j=0;j<i1;j++) printf("t%d",b[i][j]); printf("n"); } return 0; }
please input the number of rows(<=100)
3
please input the number of columns(<=100)
4
please input the element
1 2 3 4 5 6 7 8 9 10 11 12
array a:
1 2 3 4
5 6 7 8
9 10 11 12
array b:
1 5 9
2 6 10
3 7 11
4 8 12