10/*Write a ‘C’ program to display the transpose of a given 3*3 matrix*/


#include<stdio.h>
#include<conio.h>
void main()
{
int m1[10][10],trans[10][10],i,j,r,c;
clrscr();
printf(“\n How many rows and columns in the matrix:-“);
scanf(“%d%d”,&r,&c);
printf(“\n Enter the elements:-“);
for(i=0;i<r;i++)
for(j=0;j<c;j++)
{
scanf(“%d”,&m1[i][j]);
trans[j][i]=m1[i][j];
}
printf(“\n The transpose is:-\n”);
for(i=0;i<c;i++)
{
for(j=0;j<r;j++)
printf(“%5d”,trans[i][j]);
printf(“\n”);
}
getch();
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s