![]() |
VOOZH | about |
The Hollow Pyramid patterns are the variation of pyramid patterns where only the outer edges are filled with characters but the interior is left empty. In this article, we will learn how to print different hollow pyramid patterns.
There can be 5 hollow pyramid patterns corresponding to each of the normal pyramid pattern in C:
The hollow right half pyramid pattern looks like a right-angled triangle aligned to the left and with its hypotenuse towards right. It only contains the characters at its boundary and is left hollow inside.
Output
* | 1 | A
* * | 1 2 | A B
* * | 1 3 | A C
* * | 1 4 | A D
* * * * * | 1 2 3 4 5 | A B C D EThe hollow left half pyramid pattern also looks like a right-angled triangle but aligned to the right with its hypotenuse towards left and hollow from inside.
Output
* | 1 | A
* * | 1 2 | A B
* * | 1 3 | A C
* * | 1 4 | A D
* * * * * | 1 2 3 4 5 | A B C D EThe hollow full pyramid pattern looks like an equilateral triangle with the characters present at the edges, but the inside remains empty.
Output
* | 1 | A
* * | 1 3 | A C
* * | 1 5 | A E
* * | 1 7 | A G
* * * * * * * * * | 1 2 3 4 5 6 7 8 9 | A B C D E F G H I
This pattern is also similar to the Diamond Pattern but without the inner elements such that it appears hollow inside.
Output
* | 1 | A
* * | 1 3 | A C
* * | 1 5 | A E
* * | 1 7 | A G
* * | 1 9 | A I
* * | 1 7 | A G
* * | 1 5 | A E
* * | 1 3 | A C
* | 1 | A
The hollow hourglass is the pattern in which only the boundary of the hourglass pattern is visible.
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
* * | 1 3 | A C
* * | 1 5 | A E
* * | 1 7 | A G
* * * * * * * * * | 1 2 3 4 5 6 7 8 9 | A B C D E F G H I