Skip to content

Commit cbac27e

Browse files
committed
feat: Print inverted right-angled triangle with increasing numbers per row
🧠 Logic: - Outer loop runs from 1 to 5 (rows). - Inner loop prints numbers from 1 up to (5 - i + 1) for each row. - Produces an inverted number triangle where the number of elements decreases per row. Signed-off-by: Somesh diwan <[email protected]>
1 parent 93f810e commit cbac27e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Section8LoopAB/src/PatternsAB6.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
public class PatternsAB6 {
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(j+" ");
86
}
97
System.out.println("");

0 commit comments

Comments
 (0)