#include<stdio.h>
int main()
{
int mat[10][10];
int i,j,r,c;
printf("Enter number of Rows :");
scanf("%d",&r);
printf("Enter number of Cols :");
scanf("%d",&c);
/*-------------------------------------------------------------------------*/
printf("\nEnter matrix elements :\n");
for(i=0;i< r;i++)
{
for(j=0;j< c;j++)
{
scanf("%d",&mat[i][j]);
}
}
/*-------------------------------------------------------------------------*/
/*Transpose a matrix */
printf("\nTranspose Matrix is : \n");
for(i=0;i< c;i++)
{
for(j=0;j< r;j++)
{
printf("%d\t",mat[j][i]);
}
printf("\n");
}
return 0;
}
-------------------------------------------------------------
OUTPUT1:
Enter number of Rows :2
Enter number of Cols :2
Enter matrix elements :
1
2
3
4
Transpose Matrix is :
1 2 1 3
3 4 ==> 2 4
Great explanation on how to find the transpose of a matrix! Understanding matrix operations is fundamental in fields like mathematics and computer science, just like how DVHosting ensures reliable and efficient hosting solutions for your website needs.
ReplyDelete