Write a C program to read A (MxN), find the transpose of a given matrix and output both the input matrix and the transposed matrix.

Transpose of a matrix is the interchanging the rows and columns, If A is matrix of order(i*j), where i is the row and j is the column, then Transpose of A is A(j*i). Read more about C Programming Language .

Transpose of a matrix is the interchanging the rows and columns, If A is matrix of order(i*j), where i is the row and j is the column, then Transpose of A is A(j*i). Read more about C Programming Language .

/***********************************************************

* You can use all the programs on www.c-program-example.com

* for personal and learning purposes. For permissions to use the

* programs for commercial purposes,

* contact [email protected]

* To find more C programs, do visit www.c-program-example.com

* and browse!

*

* Happy Coding

***********************************************************/

*/

#include <stdio.h>

#include <conio.h>

void main()

{

int i,j,M,N;

int A[10][10], B[10][10];

int transpose(int A[][10], int r, int c); /*Function prototype*/

clrscr();

printf("Enter the order of matrix An");

scanf("%d %d", &M, &N);

printf("Enter the elements of matrixn");

for(i=0;i<M;i++)

{

for(j=0;j<N;j++)

{

scanf("%d",&A[i][j]);

}

}

printf("Matrix A isn");

for(i=0;i<M;i++)

{

for(j=0;j<N;j++)

{

printf("%3d",A[i][j]);

}

printf("n");

}

/* Finding Transpose of matrix*/

for(i=0;i<M;i++)

{

for(j=0;j<N;j++)

{

B[i][j] = A[j][i];

}

}

printf("Its Transpose isn");

for(i=0;i<M;i++)

{

for(j=0;j<N;j++)

{

printf("%3d",B[i][j]);

}

printf("n");

}

} /*End of main()*/

Read more Similar C Programs

Matrix Programs

Learn C Programming

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

(c) www.c-program-example.com