C Program to Print Pyramids and Patterns

To understand this example, you should have the knowledge of the following C programming topics:


Here is a list of programs you will find in this page.

C Examples
Half pyramid of *
Half pyramid of numbers
Half pyramid of alphabets
Inverted half pyramid of *
Inverted half pyramid of numbers
Full pyramid of *
Full pyramid of numbers
Inverted full pyramid of *
Pascal's triangle
Floyd's triangle

Example 1: Half Pyramid of *

*
* *
* * *
* * * *
* * * * *

C Program


Example 2: Half Pyramid of Numbers

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

C Program


Example 3: Half Pyramid of Alphabets

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

C Program


Example 4: Inverted half pyramid of *

* * * * *
* * * *
* * * 
* *
*

C Program


Example 5: Inverted half pyramid of numbers

1 2 3 4 5
1 2 3 4 
1 2 3
1 2
1

C Program


Example 6: Full Pyramid of *

        *
      * * *
    * * * * *
  * * * * * * *
* * * * * * * * *

C Program


Example 7: Full Pyramid of Numbers

        1
      2 3 2
    3 4 5 4 3
  4 5 6 7 6 5 4
5 6 7 8 9 8 7 6 5

C Program


Example 8: Inverted full pyramid of *

* * * * * * * * *
  * * * * * * *
    * * * * *
      * * *
        *

C Program


Example 9: Pascal's Triangle

           1
         1   1
       1   2   1
     1   3   3    1
   1  4    6   4   1
 1  5   10   10  5   1

C Program


Example 10: Floyd's Triangle.

1
2 3
4 5 6
7 8 9 10

C Program