Write the program c transpose of matrices
~~PROGRAM~~
Write the program to transpose of matrices .(2*2)
#include<stdio.h>
#include<conio.h>
int main()
{
int A[2][2],B[2][2],i,j;
for(i=0; i<2; i=i+1)
{
for(j=0; j<2; j=j+1)
{
scanf("%d",&A[i][j]);
}
}
for(i=0; i<2; i=i+1)
{
for(j=0; j<2; j=j+1)
{
B[i][j]=A[j][i];
}
}
for(i=0; i<2; i=i+1)
{
for(j=0; j<2; j=j+1)
{
printf("%d\t",B[i][j]);
}
printf("\n");
}
getch();
return 0;
}
Output----
2 3
2 5
2 2
3 5
Comments
Post a Comment