This example will show you how to compute transpose of a matrix in C program. In this example a user will be asked to enter the number of rows and columns for matrices. Then user will be asked to enter the elements at each index of the matrix. A matrix has to be square matrix for computing the transpose of that matrix.

Here we will see also how to use pointers to allocate memory dynamically for array using malloc function.

Transpose of an N x N (row x column) square matrix A is a matrix B such that an element bi,j of B is equal to the element of aj,i of A for 0<=i,j<N.

C program

Output

Thanks for reading.

Software Professional, I am passionate to work on web/enterprise application. For more information please go to about me. You can follow on Twitter. You can be a friend on Facebook or Google Plus or Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.