Right Triangle Star Pattern Problem
Right Triangle Star Pattern Problem — ExecCode School DSA Practice
Solve the Right Triangle Star Pattern problem on ExecCode. Free online school DSA practice in Patterns. Write and run code in Java, C++, Python — no signup required to run.
Problem description
You are given a number, let's call it N. Your task is to print a pattern of stars that forms a triangle shape. The pattern should have N lines in total. The first line should have one star, the second line should have two stars, the third line three stars, and so on, until the Nth line has N stars. Make sure each line of stars is printed on its own new line.
Examples
Input 5; Output ****. Input 3; Output *
Constraints
1 <= N <= 20
Practice Right Triangle Star Pattern free on ExecCode. Browse DSA problems, topic map, and placement guides.