c program transpose of a matrix,c program to find the transpose of a matrix,c program to find transpose of given matrix,write a program to find the transpose of a matrix in c,c program to print transpose of a matrix,write a c program to print a transpose of a matrix,transpose of a matrix in c language,transpose of a matrix using functions in c,transpose of a sparse matrix in c
here is C Program to finds the transpose of a given matrix with source code.
c program prints transpose of a matrix. transpose of a given matrix is formed by interchanging the rows and columns
#include"stdio.h"
#include"conio.h"
void main()
{
int mat[10][10],tran[10][10],i,j,r,c;
clrscr();
printf("\nHow many row=");
scanf("%d",&r);
printf("\nHow many column=");
scanf("%d",&c);
printf("\n\n Enter %d * %d matrix=\n",r,c);
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&mat[i][j]);
}
}
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
tran[j][i]=mat[i][j];
}
}
printf("\n\nOriginal matrix is=\n\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
printf("%4d",mat[i][j]);
}
printf("\n\n");
}
printf("\n\nTranspose matrix is=\n\n");
for(i=0;i<c;i++)
{
for(j=0;j<r;j++)
{
printf("%4d",tran[i][j]);
}
printf("\n\n");
}
getch();
}