VOOZH about

URL: https://www.geeksforgeeks.org/c/c-program-to-print-inverted-hollow-star-pyramid/

⇱ C Program To Print Inverted Hollow Pyramid Patterns - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C Program To Print Inverted Hollow Pyramid Patterns

Last Updated : 15 Dec, 2024

In C, hollow inverted pyramids are pyramid patterns that are flipped 180° vertically with the characters present only at the edge while the inside remains empty. In this article, we will learn how to print different hollow inverted pyramid patterns using C programs.

There are three common inverted hollow pyramid patterns:

Inverted Hollow Right Half Pyramid

The Inverted Hollow Right Half Pyramid Pattern is a triangular pattern where the largest row is at the top and the rows decrease in size as we move downward.


Output

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

Inverted Hollow Left Half Pyramid

The Inverted Hollow Left Half Pyramid Pattern is similar to the inverted hollow right half pyramid, but the characters are aligned to the right. The largest row is at the top, and the rows decrease in size as we move downward.


Output

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

Inverted Hollow Full Pyramid

The Inverted Hollow Full Pyramid Pattern is a variation of the inverted full pyramid where only the outer edges are filled with characters, and the inside is left empty.


Output

* * * * * * * * * | 1 2 3 4 5 6 7 8 9 | A B C D E F G H I
* * | 1 7 | A G
* * | 1 5 | A E
* * | 1 3 | A C
* | 1 | A
Comment
Article Tags: