This C program finds the transpose of a matrix, i.e. a two-dimensional array.

Transpose of a matrix is found by interchanging its rows and columns. Therefore to find the transpose of a matrix in C, you just have to convert rows into columns and columns in rows.

**Program:** Transpose of a two dimensional array in C

**Output:** Print transpose of a 3 x 3 matrix in matrix form

```
Enter the number of rows and columns of matrix: 3 3
Enter the elements of the matrix: 23 45 79 32 46 58 66 81 59
Entered matrix:
23 45 79
32 46 58
66 81 59
Transpose of entered matrix :
23 32 66
45 46 81
79 58 59
```

This program also tells how to print an array in matrix form. This program uses another array to print the transpose of the matrix. However you can print the transpose of a matrix in C without using that extra array. Below is the sample code for that.

**Program:** C program to **print **the transpose of a matrix

This program only prints the transpose of the matrix, if you have to use the transposed matrix later again, use this program.

**Output:** **Print **transpose of matrix in C

```
Enter the number of rows and columns of matrix: 3 3
Enter the elements of the matrix: 108 219 433 352 78 455 92 111 176
Entered matrix:
108 219 433
352 78 455
92 111 176
Transpose of the entered matrix:
108 352 92
219 78 111
433 455 176
```

Share your code and queries in the comments.

Share this code with your programmer friends.

Follow us on twitter.