#include "conio.h"
main()
{
int a[3][3],b[3][3],i,j;
clrscr();
printf("\n Enter the value of n = ");
for(i=0;i<3;++i)
{
for(j=0;j<3;++j)
scanf("%d",&a[i][j]);
}
printf("\n =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
printf("\n THE MATRIX OF A\n");
for(i=0;i<3;++i)
{
for(j=0;j<3;++j)
printf("%3d",a[i][j]);
printf("\n\n");
}
printf("\n THE TRANSPOSE OF MATRIX B\n");
for(i=0;i<3;++i)
{
for(j=0;j<3;++j)
{
b[i][j]=a[j][i];
printf("%3d",b[i][j]);
}
printf("\n =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
}
getch();
}
*****************************************************************
Output :
Enter the value of n = 1 2 3 4 5 6 7 8 9
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
THE MATRIX OF A
1 2 3
4 5 6
7 8 9
THE TRANSPOSE OF MATRIX B
1 4 7
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
2 5 8
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
3 6 9
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
No comments:
Post a Comment