Update OOP/Java/Lab/Week4/SymmMatrixCheck.java

This commit is contained in:
Aadit Agrawal 2024-08-31 09:26:09 +05:30
parent 3c0de68177
commit 1903c1a586

View File

@ -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;