See More

/* * Program checks if Matrix is symmetric or not and finds the sum of left and right diagonals * Accept size M * Input values in array * Display original matrix * Check if marix is symmetric * Add left diagonal elements and right diagonal elements * Display if the matrix is symmetric or not * Print sum of left and right diagonal elements */ import java.util.*; class SymmetricMatrix { void main() { int M; int arr[][]; Scanner sc=new Scanner(System.in); System.out.println("Enter number of rows and coloumn"); M=sc.nextInt(); arr=new int[M][M]; if( M<=0) { System.out.println("Enter positive number"); } else { int lsum=0; int rsum=0; for(int i=0; i