Skip to content

Commit 531a276

Browse files
committed
feat: Print inverted right-angled triangle with repeated row numbers
🧠 Logic: - Outer loop runs from 1 to 5 (each row). - Inner loop prints the current row number `i`, (5 - i + 1) times. - Pattern creates decreasing rows with the same number printed repeatedly. Signed-off-by: Somesh diwan <[email protected]>
1 parent cbac27e commit 531a276

File tree

1 file changed

+3
-5
lines changed

1 file changed

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

0 commit comments

Comments
 (0)