





Right Triangle Star Pattern in JAVA
Right Triangle Star Pattern
Here we want to print the Right Triangle Star Pattern in Java to do so we need two loop i.e. Outer loop and inner loop.
To print all the star in a row we needed First loop that is the outer loop and For Column we needed second loop that is inner loop mean how many stars you want to put in the single line.so for the desired pattern these two loops are required here we need to now proper working of the loop that we can easily make a pattern. Star patterns are a series of * or any other character used to create some pattern

Write a Program to print the following pattern.
* * * * * * * * * * * * * * *
Working
- Step 1- First you need to initialize two variable for loop.
- Step 2- The first loop for the row.
- Step 3- The second loop work for the column.
- Step 4- Now print the *.
- Step 5- Now out side of loop, put new line.
- Step 5- Stop.
Program in Java to print Right Triangle Star Pattern
public class Main { public static void main(String[] args) { int i,j; //this loop work on the row for(i=0;i<5;i++) { //this loop work on the column for(j=1;j<=i;j++) { System.out.print("* "); } System.out.println(); } } }
November 1, 2021
Login/Signup to comment