Sitemap

RIGTH TRIANGLE STAR PATTERN

Jul 26, 2023

--

import java.io.*;

import java.util.*;

public class RightTrianglePattern

{

public static void main(String args[])

{

//i for rows and j for columns

//row denotes the number of rows you want to print

int i, j, row=6;

//outer loop for rows

for(i=0; i<row; i++)

{

//inner loop for columns

for(j=0; j<=i; j++)

Get Logapranesh S’s stories in your inbox

Join Medium for free to get updates from this writer.

{

//prints stars

System.out.print(“* “);

}

//throws the cursor in a new line after printing each line

System.out.println();

}

}

}

OUTPUT:

*

* *

* * *

* * * *

* * * * *

--

--