Write a c program to read a matrix (m x n) column-wise, then transpose the
matrix and get the output printed row-wise in the matrix form.
#include
#include
void main()
{
int a[3][3],b[3][3],i,j;
clrscr();
printf("\nEnter the matrix:\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
b[j][i]=a[i][j];
}
}
printf("\nTranspose Matrix:\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d\t",b[i][j]);
printf("\n");
}
getch();
}
/*Output
Enter the matrix:
12 23 34
45 56 67
78 89 90
Transpose Matrix:
12 45 78
23 56 89
34 67 90
*/
Shopping In MUMBAI
Are you searching for Discounts, offers, sale in Mumbai ? You are in the right place. MUMBAI, a shopping haven, has no dearth of great discounts and sales. This blog features the best MUMBAI shopping offers, sale, discounts and deals and bargains CURRENTLY GOING on in Mumbai plus a few free things thrown in on top.
Don't wait for it because once they are gone, they are gone. Hurry!..By clicking the "Like" button you will receive a daily update of discounts, sale, offers going on in Mumbai. LIKE IT.... SHARE IT...njoY.
Wednesday, December 31, 2008
C program to read a matrix (m x n) column-wise, then transpose the matrix
Posted by ars at 11:03 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment