Write a program to find transpose of a matrix

```#include<stdio.h>
int main()
{
int a[10][10], transpose[10][10], r, c, i, j;
printf("Enter rows and columns of matrix: ");
scanf("%d %d", &r, &c);
// Storing elements of the matrix
printf("Enter elements of matrix:");
for(i=0; i < r; ++i)
for(j=0; j < c; ++j)
{
printf("Enter element a%d%d: ",i+1, j+1);
scanf("%d", &a[i][j]);
}
// Displaying the matrix a[][] */
printf("Entered Matrix: ");
for(i=0; i < r; ++i)
for(j=0; j < c; ++j)
{
printf("%d  ", a[i][j]);
if (j == c-1)
printf("");
}
// Finding the transpose of matrix a
for(i=0; i < r; ++i)
for(j=0; j < c; ++j)
{
transpose[j][i] = a[i][j];
}
// Displaying the transpose of matrix a
printf("Transpose of Matrix:");
for(i=0; i < c; ++i)
for(j=0; j < r; ++j)
{
printf("%d  ",transpose[i][j]);
if(j==r-1)
printf(" ");
}
return 0;
}
```

Output

```
Enter rows and columns of matrix: 2
3
Enter element of matrix:

Enter element a11: 2
Enter element a12: 3
Enter element a13: 4
Enter element a21: 5
Enter element a22: 6
Enter element a23: 4

Entered Matrix:
2  3  4
5  6  4

Transpose of Matrix:
2  5
3  6  ```

Explanation

```	In this program,we have transpose the matrix and display it onto the screen.
```