Skip to content

Commit 74ea5a8

Browse files
committed
feat: Print inverted right-angled triangle star pattern
🧠 Logic: - Outer loop runs from 1 to 5 for each row. - Inner loop prints '*' (5 - i + 1) times, decreasing with each row. - Forms an inverted triangle of stars aligned to the left. Signed-off-by: Somesh diwan <[email protected]>
1 parent 531a276 commit 74ea5a8

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 PatternsAB8 {
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("* ");
86
}
97
System.out.println("");
108
}
119
}
12-
}
10+
}

0 commit comments

Comments
 (0)