VOOZH about

URL: https://www.geeksforgeeks.org/c/c-program-to-print-character-pyramid-pattern/

⇱ C Program To Print Character Pyramid Pattern - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C Program To Print Character Pyramid Pattern

Last Updated : 11 Dec, 2024

Pyramid patterns is a classic logical programming exercise where a triangular looking pattern is printed by treating the output screen as a matrix and printing a given character. In this article, we will explore how to print various alphabet pyramid patterns using C program.


Half Pyramid Pattern

Half Pyramid Pattern is a triangular pattern where each row starts with 'A' and increases by one character per row. Characters are aligned to the left resembling a right-angled triangle with the hypotenuse facing right.


Output
A 
A B 
A B C 
A B C D 
A B C D E 

Inverted Half Pyramid Pattern

Inverted half pyramid pattern is nothing but the half pyramid pattern flipped vertically.


Output
A B C D E 
A B C D 
A B C 
A B 
A 

Full Pyramid Pattern

The Full Pyramid Pattern looks like an equilateral triangle pattern where each row increases the number of characters by 2 from the top to the bottom row.


Output
 A 
 A B C 
 A B C D E 
 A B C D E F G 
 A B C D E F G H I 

Hollow Pyramid Pattern

The Hollow Pyramid Pattern forms a full pyramid where only the outer edges are filled with characters and the inner part of the pyramid is empty, creating a hollow space inside the shape.


Output
 A 
 A C 
 A E 
 A G 
 A B C D E F G H I 

Diamond Pyramid Pattern

The Diamond Pyramid Pattern can be considered as made up of two halves. The top half is a regular pyramid with increasing characters and the bottom half is an inverted pyramid with decreasing characters forming a diamond-like shape.


Output
 A 
 A B C 
 A B C D E 
 A B C D E F G 
 A B C D E F G H I 
 A B C D E F G 
 A B C D E 
 A B C 
 A 
Comment
Article Tags: