TRANSPOSE OF A MATRIX
TRANSPOSE OF A MATRIX: A=[2 3 4] A'=[2 1] [1 2 3] [3 2] [4 3] C SOURCE CODE : #include<stdio.h> #include<conio.h> void main() { int m,n,i,j,a[20][20],b[20][20]; printf("\n Enter the no. of rows in matrix:"); scanf("%d",&m); printf("\n Enter the no. of columns in matrix:"); scanf("%d",&n); printf("\n Enter the matrix:"); for(i=0;i<m;i++) { for(j=0;j<n;j++) scanf("%d",&a[i][j]); } printf("\n MATRIX IS:\n"); for(i=0;i<m;++i) { for(j=0;j<n;j++) printf("%5d",a[i][j]); printf("\n"); } } for(i=0;i<m;i++) { for(j=0;j<n;j++) a[i][j]=b[j][i]; } printf("\n TRANSPOSE OF MATRIX :\n"); for(i=0;i<n;++i) { for(j=0;j<m;j++) printf("%5d",a[i][j]); printf("\n"); } getch(); }