VOOZH about

URL: https://www.geeksforgeeks.org/c/c-program-for-printing-simple-half-right-star-pyramid-pattern/

⇱ C Program to Print Right Half Pyramid Pattern - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C Program to Print Right Half Pyramid Pattern

Last Updated : 10 Dec, 2024

The Right Half Pyramid Pattern is a triangular pattern consists of rows where each row contains an increasing number of characters. The number of characters starts from 1 and increases by 1 in each subsequent row. Characters are aligned to the left, resembling a right-angle triangle with its hypotenuse in right direction.

In this article, we will learn how to print a right half pyramid pattern in C.

👁 Half-Right-Star-Pyramid-


Output

* | 1 | A
* * | 1 2 | A B
* * * | 1 2 3 | A B C
* * * * | 1 2 3 4 | A B C D
* * * * * | 1 2 3 4 5 | A B C D E

Explanation:

  • Outer loop iterates over the rows, from i = 0 to i = n - 1.
  • Inner loop prints the stars (*) (or number/character) on each row. The number of stars printed increases as i increases. On row i, it prints i + 1 stars.
Comment
Article Tags: