Saturday, May 21, 2011

C Program to compute transpose of matrix

#include
#include
int main()
{
int a[20][20],b[20][20],i,j,m,n,k=0;
printf("\t\tenter rows and columns of matrix -A \n");
scanf("%d%d",&m,&n);
printf("\n\nInput Matrix A\n");
for(i=0;i {
for(j=0;j {
printf("\nEnter element ");
scanf("%d",&a[i][j]);
}
}
printf("\n matrix A is:\n ");
for(i=0;i {
printf("\n\n");
for(j=0;j printf("\t%d",a[i][j]);
}
for(i=0;i { printf("\n\n");
for(j=0;j b[j][i]=a[i][j];
}
printf("\n\ntranspose of matrix is :\n\n ");
for(i=0;i {
printf("\n\n");
for(j=0;j printf("\t%d",b[i][j]);
}
getch();
}

No comments:

Post a Comment