|
#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.
Related source codes :
To find the sum of two
matrices
To find the difference of
two matrices
To multiply two matrices
To find the sum of primary
diagonal of a matrix
To find the sum of
secondary diagonal of a matrix
Select program from the list |