• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
May 27, 2022 |6.8K Views
Java Program to Print Star Pattern in Triangle Shape
  Share   Like
Description
Discussion

In this video, we will see Print Pattern with star (*) symbol in Java Program. Here we see the right triangle star pattern is also quite a simple pattern. It has a shape of a triangle with its perpendicular line at the right side.

Input : n = 5
Output:
*
* *
* * *
* * * *
* * * * *

Algorithm:

Steps to create a left triangle star pattern in Java:

Step 1: Take the size of the triangle.
Step 2: Create a nested loop and repeat the outer loop for times equal to the size of the triangle.
Step 3: Repeat the inner loop for times equal to the index of the outer loop and print star (*).

Java program to print pyramid pattern: https://www.geeksforgeeks.org/programs-printing-pyramid-patterns-java/

Read More