Here is the program to transpose the entered matrix. The program asks for the order (M, N) of the matrix Soon after entering the order, the cursor takes to the proper position in the screen to input the matrix. User need to hit ‘Enter’ button after each entry.
Logic : A simple logic lies here. We declare another matrix B with order (N, M). The first matrix is traced through the first entry, till the end. The member is copied to another matrix with interchanging the column and rows count. Finally, the matrix B will be the transpose of the entered matrix A.
Please find the
other matrix related programs from the index.
int A, B, i, j, m, n;
printf(“\n\n\t ENTER A ORDER OF THE MATRIX M,N…: “);
printf(“\n\n\t ENTER THE ELEMENTS OF THE MATRIX..:\n\n”);
B[j][i] = A[i][j];
printf(“\n\t THE TRANSPOSE OF A MATRIX IS…:\n\n\t\t “);
Download exe and source code here.