Pages

Adsense responsive

Tuesday, 5 February 2013

C PROGRAM: TO FIND TRANSPOSE OF A MATRIX

CODING:
#include<conio.h>
#include<stdio.h>
void main()
{
int a[10][10],b[10][10],i,j,m,n;
clrscr();
printf("Enter order of matrix for m and n ");
scanf("%d%d",&m,&n);
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
printf("Enter value of a[%d][%d] ",i,j);
scanf("%d",&a[i][j]);
b[j][i]=a[i][j];
}
}
printf("\nTranspose of matrix:\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
printf("%4d",b[i][j]);
}
printf("\n");
}
getch();
}


CODING

OUTPUT

For any query or suggestion please comment below...

No comments:

Post a Comment