Skip to content

Commit 400a73a

Browse files
committed
feat: Implement input and display of 2x2 2D array using nested loops
🧠 Logic: - Declares a 2D array `A` of size 2x2. - Takes input from the user using nested for-loops (`i` for rows, `j` for columns). - Displays the array elements in matrix format using the same nested loop structure. Signed-off-by: Somesh diwan <[email protected]>
1 parent c85e15f commit 400a73a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Section9ArrayAB/Array IMP/TwoDArrayPractice.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ public static void main(String[] args) {
1212
for(int j = 0; j<2; j++) {
1313
A[i][j] = sc.nextInt();
1414
}
15-
}
15+
}
1616

1717
System.out.println("Array elements are: ");
1818
for(int i = 0; i<2; i++) {
1919
for (int j = 0; j<2; j++) {
2020
System.out.print(A[i][j]+" ");
2121
}
2222
}
23+
2324
System.out.println("");
2425
}
2526
}

0 commit comments

Comments
 (0)