Given a matrix and we have to check whether it is symmetric or not using Java program?
Symmetric Matrix
If the sum of the left diagonal and right diagonal of the matrix is equal then the above matrix is said to be symmetric matrix. The entries of a symmetric matrix are symmetric with respect to the main diagonal.
Example:
Enter the number of elements : 3
Input the elements of the Matrix :
Enter the elements : 11
Enter the elements : 11
Enter the elements : 11
Enter the elements : 11
Enter the elements : 11
Enter the elements : 11
Enter the elements : 11
Enter the elements : 11
Enter the elements : 11
The Original Matrix is :
11 11 11
11 11 11
11 11 11
The given Matrix is Symmetric
The sum of the left diagonal = 33
The sum of the right diagonal = 33
Program to check matrix is symmetric or not in java
Output