$(document).ready(function() { $('pre code').each(function(i, block) { hljs.highlightBlock(block); }); });

Sunday, July 11, 2010

Matrix Transpose (using array)

#include
#include
void main()
{
int i,j,m,n,mat[9][9];
clrscr();
printf("Enter the order of matrix:\n");
scanf("%d%d",&m,&n);
printf("Enter the matrix terms:\n\n");
for(i=0;i{
for(j=0;j{
gotoxy(10+4*j,5+2*i);
scanf("%d",&mat[i][j]);
}}
printf("\nThe original matrix is:\n\n");
for(i=0;i{
printf("\t|");
{
for(j=0;jprintf("%3d",mat[i][j]);
}
printf("|\n");
}
printf("\nThe Transpose of the above matrix is:\n\n");
for(j=0;j{
printf("|");
for(i=0;i{
printf("%3d",mat[i][j]);
}
printf(" |\n");
}
getch();
}

No comments:

Post a Comment

Contact Me

Name

Email *

Message *