Right-Angled Triangle With Asterisks Algorithm

Princy Prakash
1 min readMay 25, 2023

--

ALGORITHM:

  1. Get the input n, which represents the number of rows and columns for the triangle.
  2. Initialize two loops:
  • The outer loop with variable i starts from 0 and continues until i < n.
  • The inner loop with variable j starts from 0 and continues until j < n

3. Within the inner loop, perform the following steps:

  • Print an asterisk (*) to create the visual pattern of the triangle.
  • Increment j by 1 to move to the next column.

4. After the inner loop completes, create a new line to move to the next row.

5. Increment i by 1 to move to the next row in the outer loop.

6. Repeat the above steps until the outer loop condition (i < n) is satisfied.

7. The algorithm will create a right-angled triangle pattern with n rows and n columns, where each position in the triangle is filled with an asterisk (*).

FLOWCHART:

--

--

Princy Prakash
Princy Prakash

Written by Princy Prakash

Hi I Am Princy. I recently discovered my passion for programming and excited to get deeper into the world of technologies also in problem-solving

No responses yet