The transpose of a matrix is a new matrix that is obtained by exchanging the rows and columns.
In this program, the user is asked to enter the number of rows r and columns c. Their values should be less than 10 in this program.
Then, the user is asked to enter the elements of the matrix (of order r*c).
The program below then computes the transpose of the matrix and prints it on the screen.
Program to Find the Transpose of a Matrix
Output
Enter rows and columns: 2 3 Enter matrix elements: Enter element a11: 1 Enter element a12: 4 Enter element a13: 0 Enter element a21: -5 Enter element a22: 2 Enter element a23: 7 Entered matrix: 1 4 0 -5 2 7 Transpose of the matrix: 1 -5 4 2 0 7