Skip to content

Commit 7ae3f33

Browse files
committed
feat: Print square pattern with repeating row numbers using nested loops
🧠 Logic: - Outer loop controls the rows (1 to 5). - Inner loop prints the current row number 5 times. - Results in a square grid with identical numbers in each row. Signed-off-by: Somesh diwan <[email protected]>
1 parent cf1a6ca commit 7ae3f33

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
public class PatternsAB1 {
22
public static void main(String[] args) {
3-
for (int i =1; i<=5; i++)
4-
{
5-
for (int j=1; j<=5; j++)
6-
{
7-
System.out.print(i+" "); //Observation is important to draw a patterns.
3+
for (int i =1; i<=5; i++) {
4+
for (int j=1; j<=5; j++) {
5+
System.out.print(i+" "); //Observation is important to draw a pattern.
86
}
97
System.out.println(" ");
108
}
119
}
12-
}
10+
}

0 commit comments

Comments
 (0)