Author Topic: Program in C to transpose the 3x3 matrix  (Read 31857 times)

thiruvasagamani

  • Old Members
  • Hero Member
  • *
  • Posts: 6887
    • View Profile
Program in C to transpose the 3x3 matrix
« on: August 01, 2008, 10:26:08 am »
Program in C to transpose the 3 x 3 matrix

Code: [Select]
#include<stdio.h>
#include<conio.h>

main ()
{

int a[3][3], b[3][3];

readmatrix(a);

transpose(a,b);

printmatrix(b);

getch();

}



readmatrix(m)
int m[][3];
{
int i, j;

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

scanf("%d", &m[i][j]);
}


transpose(a,b)
int a[][3], b[][3];
{
int i, j;

for(i=0;i<3;i++)
for (j=0; j<3;j++)
{
b[j][i]=a[i][j];
}

}

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

}

Thiruvasakamani Karnan