#include<stdio.h>
#include<conio.h>
int main()
{
int matrix[3][3],c,r;
for(c=0;c<3;c++)
{printf(“Enter ‘%d’ row values\n”,(c+1));
for(r=0;r<3;r++)
scanf(“%d”,&matrix[r][c]);
}
printf(“The matrix is: \n”);
for(c=0;c<3;c++)
{
for(r=0;r<3;r++)
{
printf(“%d\t”,matrix[r][c]);
}
printf(“\n”);
}
printf(“The transpose of Matrix: \n”);
for(c=0;c<3;c++)
{
for(r=0;r<3;r++)
{
printf(“%d\t”,matrix[c][r]);
}
printf(“\n”);
}
getch();
}
<———-End——–>
Output will be:
Enter ‘1’ row values:
3
4
5
Enter ‘2’ row values:
6
7
8
Enter ‘3’ row values:
9
10
11
the matrix is:
3 4 5
6 7 8
9 10 11
the tranpose of matrix :
3 6 9
4 7 10
5 8 11