#include<stdio.h>
#include<conio.h>
main()
{
int mat[3][3]={1,2,3,4,5,6,7,8,9};
int i,j;
clrscr();
printf("\n show the matrixs=");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%5d",mat[i][j]);
}
printf("\n");
}
printf("\n Transpose of matrixs=");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%5d",mat[j][i]);
}
printf("\n");
}
getch();
}
output:-show the matrix=1 2 3
4 5 6
7 8 9
transpose of matrix=1 4 7
2 5 8
3 6 9
No comments:
Post a Comment