8

Java Program to Print Star Pattern in Triangle Shape

 1 year ago
source link: https://www.geeksforgeeks.org/videos/java-program-to-print-star-pattern-in-triangle-shape/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Java Program to Print Star Pattern in Triangle Shape

Java Program to Print Star Pattern in Triangle Shape
Hello everyone. My name is iron today. We are
  • 90 Views
  • 27/05/2022

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/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK