![]() |
VOOZH | about |
In this article, we will discuss the following top 16 pattern programs in C++ using star ( * ), numbers or other characters.
Table of Content
Creating patterns is a fun way to practice your C++ skills. The C++ Course includes hands-on examples and exercises for printing various patterns, helping you enhance your problem-solving abilities. Here are some of the most common patterns with their logic.
Printing simple pyramid pattern using for loop
* * * * * * * * * * * * * * *
Time Complexity: O(n2), where n is the input number of rows.
Auxiliary Space: O(1),
Printing the above pattern using while Loop
* * * * * * * * * * * * * * *
Printing the above pattern using recursion.
* * * * * * * * * * * * * * *
Printing the 180° rotated simple pyramid pattern using for loop.
* * * * * * * * * * * * * * *
Printing the above pattern using while loop.
* * * * * * * * * * * * * * *
Printing the pattern using for loop.
* * * * * * * * * * * * * * *
Printing the pattern using while loop.
* * * * * * * * * * * * * * *
Printing the above pattern using recursion.
* * * * * * * * * * * * * * *
Printing this pattern using for loop.
* * * * * * * * * * * * * * *
Method 2: Printing the above pattern using while loop.
* * * * * * * * * * * * * * *
Printing the given pattern using for loop.
* * * * * * * * * * * * * * *
Printing the above pattern using while loop.
* * * * * * * * * * * * * * *
Printing the inverted triangle pattern using for loop.
* * * * * * * * * * * * * * * * * * * * * * * * *
Printing the above pattern using while loop.
* * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * *
* ** *** **** ***** **** *** ** *
* *** ***** ******* ********* ******* ***** *** *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Printing the number pyramid pattern using for loop.
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
Printing the above pattern using while loop.
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
Printing the number pyramid pattern in C++ without reassigning using for loop.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Printing the above pattern using while loop.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 2 3 3 4 5 4 5 6 7 5 6 7 8 9
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
Printing the given pattern using for loop.
A B B C C C D D D D E E E E E
Printing the above pattern using while loop.
A B B C C C D D D D E E E E E
Method 1:
Printing the above pattern using for loop.
A B C D E F G H I J K L M N O
Printing the above pattern using while loop.
A B C D E F G H I J K L M N O
Printing patterns in python language are discussed in the following article - Programs for printing pyramid patterns in Python