Thanks!
#include<stdio.h>
int main(void)
{
int mat[10][10],i,j,cols,rows;
// printf("Enter the number of columns");
// scanf("%d", cols);
// printf("Enter your rows ");
// scanf("%d", rows);
printf("Enter your matrix\n");
for(i=0;i<2;i++)
for(j=0;j<2;j++)
{
scanf("%d",&mat[i][j]);
}
printf("\nHere is your matrix:\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d ",mat[i][j]);
}
printf("\n");
}
printf("The transpose is:\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
//mat[i][j]= mat[j][i];
// printf("The transpose is:\n");
printf("%d ", mat[j][i]);
}
printf("\n");
}
return 0;
}

New Topic/Question
Reply



MultiQuote



|