#include<stdio.h>
int main()
{
int n,m,a[100][100],i,j;
printf("Enter row and col:");
scanf("%d%d",&n,&m);
printf("Matrix A :
");
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
printf("a[%d][%d] :",i,j);
scanf("%d",&a[i][j]);
}
}
printf("Transpose of Matrix :
");
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
printf("%d ",a[j][i]);
}
printf("
");
}
}
#include<stdio.h>
void main(){
int row,column,i,j,mat[100][100],tra[100][100];
printf("Enter number of rows of matrix : ");
scanf("%d",&row);
printf("Enter number of columns of matrix : ");
scanf("%d",&column);
printf("#### Matrix ####
");
for(i=0;i<row;i++){
for(j=0;j<column;j++){
printf("Enter element a %d%d : ",i+1,j+1);
scanf("%d",&mat[i][j]);
}
}
for(i=0;i<row;i++){
for(j=0;j<column;j++){
tra[i][j] = mat[j][i];
}
}
for(i=0;i<row;i++){
for(j=0;j<column;j++){
printf("%d ",tra[i][j]);
}
printf("
");
}
}