Question: Convert from C code to Java code: / * C Program for comparison of Symmetric Matrices * / #include #include main ( ) { int

Convert from C code to Java code:
/* C Program for comparison of Symmetric Matrices */
#include
#include
main()
{
int m, n, c, d, matrix[10][10], transpose[10][10];
printf("Enter the number of rows and columns of matrix
");
scanf("%d%d",&m,&n);
printf("Enter the elements of matrix
");
for ( c =0 ; c < m ; c++)
for ( d =0 ; d < n ; d++)
scanf("%d",&matrix[c][d]);
for( c =0 ; c < m ; c++)
{
for( d =0 ; d < n ; d++)
{
transpose[d][c]= matrix[c][d];
}
}
if ( m == n )/* check if order is same */
{
for ( c =0 ; c < m ; c++)
{
for ( d =0 ; d < m ; d++)
{
if ( matrix[c][d]!= transpose[c][d])
break;
}
if ( d != m )
break;
}
if ( c == m )
printf("Symmetric matrix.
");
}
else
printf("Not a symmetric matrix.
");
return 0;}}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!