diff --git a/OOP/Java/Lab/Week4/SymmMatrixCheck.java b/OOP/Java/Lab/Week4/SymmMatrixCheck.java index 9239731..e32927a 100644 --- a/OOP/Java/Lab/Week4/SymmMatrixCheck.java +++ b/OOP/Java/Lab/Week4/SymmMatrixCheck.java @@ -4,14 +4,12 @@ class SymmMatrixCheck { public static void main(String args[]) { Scanner sc = new Scanner(System.in); - System.out.print("Enter the number of rows in the matrix: "); + System.out.print("Enter the number of rows and columns in the matrix: "); int m = sc.nextInt(); - System.out.print("Enter the number of colums in the matrix: "); - int n = sc.nextInt(); - int a[][] = new int[m][n]; + int a[][] = new int[m][m]; for (int i = 0; i < m; i++) { - for (int j = 0; j < n; j++) { + for (int j = 0; j < m; j++) { System.out.print( "Enter the element at (" + i + "," + j + "): " ); @@ -21,7 +19,7 @@ class SymmMatrixCheck { boolean isSymmetric = true; for (int i = 0; i < m; i++) { - for (int j = 0; j < n; j++) { + for (int j = 0; j < m; j++) { if (i != j && a[i][j] != a[j][i]) { isSymmetric = false; break;