Program in C to transpose the 3x3 matrix

Started by thiruvasagamani, Aug 01, 2008, 10:26 am

previous topic - next topic
Go Down

thiruvasagamani

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


Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:
Verification:
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview