Skip to content

Commit 189c61e

Browse files
committed
feat: Display coordinate pairs using nested for loops
🧠 Logic: - Outer loop (`i`) runs from 1 to 5 representing the row. - Inner loop (`j`) runs from 0 to 5 representing the column. - For each combination, print the coordinate pair `(i, j)` on the same line. - After each outer loop iteration, print a newline to separate rows. Signed-off-by: Somesh diwan <[email protected]>
1 parent 241fbde commit 189c61e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Section8LoopAB/Loop 2.O/src/NestedLoopAB.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
public class NestedLoopAB {
2-
public static void main(String[] args)
3-
{
2+
public static void main(String[] args) {
43
for(int i =1; i<=5; i++)
54
{
65
for(int j=0; j<=5; j++)
76
{
8-
System.out.print("("+i+","+j+") ");
7+
System.out.print("("+i+","+j+") ");
98
}
109
System.out.println(" "); //Print on new line hence println();
1110
}

0 commit comments

Comments
 (0)