#include<stdio.h>
int main()
{
int i,j,p,q,d,a[10][10],b[10][10],c[10][10];
printf("\nEnter the number of rows and columns of the matrix \n\n");
scanf("%d%d",&p,&q);
printf("\nEnter the %d elements of the A matrix \n\n", p*q);
for(i = 0; i< p; i++)
{
for(j = 0; j< q; j++)
{
scanf("%d", &a[i][j]);
}
}
printf("\nEnter the %d elements of the B matrix \n\n", p*q);
for(i = 0; i< p; i++)
{
for(j = 0; j< q; j++)
{
scanf("%d", &b[i][j]);
}
}
for(i = 0; i< p; i++)
{
for(j = 0; j< q; j++)
{
c[i][j]=b[j][i];
}
}
printf("\n\nThe Transpose of 2nd matrix is: \n\n");
for(i = 0; i < p; i++)
{
for(j= 0; j< q; j++)
{
printf("%d\t", c[i][j]);
}
printf("\n");
}
d=0;
for(i = 0; i < p; i++)
{
for(j= 0; j< q; j++)
{
if(a[i][j]==c[i][j])
{
d++;
}
}
}
if(d==p*q)
{
printf("\n\nThe matrix B is a Symmetric of A Matrix\n\n");
}
else {
printf("\n\nThe matrix B is a not Symmetric of A Matrix\\n\n");
}
return 0;
}
Note: Need to be arranged in compiler after copied
OutPut:
Enter the number of rows and columns of the matrix
3
3
Enter the 9 elements of the A matrix
1
2
3
4
5
6
7
8
9
Enter the 9 elements of the B matrix
1
4
7
2
5
8
3
6
9
The Transpose of 2nd matrix is:
1 2 3
4 5 6
7 8 9
The matrix B is a Symmetric of A Matrix