Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions C/matrixTranspose.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// transpose matrix

#include <stdio.h>
int main()
{
int mtr[3][3];
int trns[3][3];
printf("Enter the 3*3 matrix : \n");
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
printf("enter the value of [%d][%d] : ", i, j);
scanf("%d",&mtr[i][j]);
}
}
printf("You entered the matrix\n");

for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
printf("%d",mtr[i][j]);
}
printf("\n");
}

printf("Transpose of the matrix\n");

for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{

printf("%d",mtr[j][i]);
trns[i][j] = mtr[j][i];
}
printf("\n");
}
}