Program to obtain 3*4 matrix and transpose of it.
/*Q.7.Program to obtain 3*4 matrix and transpose of it.
Programmed by: Jitendra Kr Yadav
Roll : 10116
Date: 2011/04/10*/
#include <stdio.h>
#include <conio.h>
void main()
{
int a[3][4] ={{1,2,3,4},{6,4,7,9},{9,4,2,7}};
int c[4][3];
int i,j;
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
c[j][i] = a[i][j];
}
printf (“\n”);
}
for(i=0;i<4;i++)
{
printf(“\n”);
for(j=0;j<3;j++)
printf(“%d\t”,c[i][j]);
}
getch();
}
Result: –
1 6 9
2 4 4
3 7 2
4 9 7
Comments (1)