Algorithm and Flowchart to Find transpose of a matrix


Algorithm to find transpose of a matrix

Transpose of a matrix is obtained by changing rows to columns and columns to rows.

Flowchart to find transpose of a matrix

Flowchart to find transpose of a matrix

Pseudocode to find transpose of a matrix

Step 1: Start Step 2: Declare matrix a[m][n] of order mxn Step 3: Read matrix a[m][n] from User Step 4: Declare matrix b[m][n] of order mxn Step 5: // Transposing the Matrix 5.1: Declare variables i, j 5.2: Set i=0, j=0 5.3: Repeat until i < n 5.3.1: Repeat until j < m b[i][j] = a[j][i] j=j+1 // Increment j by 1 5.3.2: i=i+1 // Increment i by 1 5.4: Print matrix b // The matrix b is the transpose of a and can be printed now Step 6: Stop

In the above algorithm,

  1. We first declare two matrices a and b of order mxn
  2. Then we read matrix a from the user. We will use matrix b to store transpose of the matrix.
  3. Now, we declare two variables i, j and intialize them to 0
  4. After this we start a loop of i, till it reaches n which gave us the column indexes and insude it a loop of j which gives us the elements of the row.
The statement b[i][j] = a[j][i] gives the value of a by changing the row to column and column to row and stores in b. for e.g. i=1, j=2 then b[1][2]=a[2][1], thus assigning the matrix b to the transpose of a.



Algorithm Logic Test

Our Quiz prepared by Experts Helps you identify your knowledge in Algorithms. Everyone should atleast attempt this Quiz Once. 

Need any help in Programming? Chat with Us


1 comment
  • C.kokilavani

    I want program in c programs books in gmail please send the book

Online Compiler
Algorithm Quiz

Only 5% Users were able to score above 75% in this Quiz. Can You Crack this?

Deals Ends in

Online Games
Play 2048 Game Online and Relax.
Play 2048 Game Online

Search Tags

    Pseudocode for transpose of a matrix