How to write a C Program To Find Transpose Of A Matrix in C Programming Language ?
Solution For C Program :
/*C Program To Find Transpos Of A Matrix.*/
#include<stdio.h>
#include<conio.h>
void main()
{
int mat1[10][10];
int i,j,r,c;
clrscr();
printf("enter the no of rows=");
scanf("%d",&r);
printf("enter the no of column=");
scanf("%d",&c);
printf("enter the Ist matrix\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&mat1[i][j]);
}
}
printf("\n\n\nFirst Entered matrix is:\n");
for(i=0;i<r;i++)
{
printf("\n");
for(j=0;j<c;j++)
{
printf("\t%d",mat1[i][j]);
}
}
printf("\n\nTranspose of matrix is:\n");
for(i=0;i<c;i++)
{
printf("\n");
for(j=0;j<r;j++)
{
printf("\t%d",mat1[j][i]);
}
}
getch();
}
You may also learn these C Program/Code :