Here is the program to transpose the entered matrix. The program asks for the order (M, N) of the matrix Soon after entering the order, the cursor takes to the proper position in the screen to input the matrix. User need to hit ‘Enter’ button after each entry.

Logic : A simple logic lies here. We declare another matrix B with order (N, M). The first matrix is traced through the first entry, till the end. The member is copied to another matrix with interchanging the column and rows count. Finally, the matrix B will be the transpose of the entered matrix A.

Please find the

other matrix related programs from the index.

#include<stdio.h>

void main()

{

int A[5][5], B[5][5], i, j, m, n;

clrscr();

printf(“\n\n\t ENTER A ORDER OF THE MATRIX M,N…: “);

scanf(“%d,%d”,&m,&n);

printf(“\n\n\t ENTER THE ELEMENTS OF THE MATRIX..:\n\n”);

for(i=1;i<=m;i++)

{

for(j=1;j<=n;j++)

{

gotoxy(20+j*4,12+i*2);

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

}

printf(“\n”);

}

for(i=1;i<=m;i++)

for(j=1;j<=n;j++)

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

printf(“\n\t THE TRANSPOSE OF A MATRIX IS…:\n\n\t\t “);

for(i=1;i<=n;i++)

{

for(j=1;j<=m;j++)

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

printf(“\n\n\t\t “);

}

getch();

}

Download exe and source code here.

I am in fact glad to glance at this weblog posts which carries plenty of valua...

Stupid program has so many errors....

I do not see many comments here, it means you have not many visitors. I know how...

bharath answer is right...

I'd like to find out more? I'd want to find out more details....