Skip to content

Commit cf1a6ca

Browse files
committed
feat: Print right-angled triangle star pattern using nested loops
🧠 Logic: - Outer loop controls the number of rows (1 to 5). - Inner loop prints increasing number of stars per row. - Each row ends with a newline to form a right-angled triangle. Signed-off-by: Somesh diwan <[email protected]>
1 parent 20c76c9 commit cf1a6ca

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Section8LoopAB/src/PaternsAB6.java

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

0 commit comments

Comments
 (0)