0
how to print following pattern in c++ ?
PYRAMID 1 1 2 A 1 2 3 A B 1 2 3 4 A B C HOW TO PRINT ABOVE PATTERN ? link to the code: https://code.sololearn.com/c4s37C9zEPUS
4 Answers
+ 1
Do you have an attempt in which you tried to do so yourself?
+ 1
Nice question!
Looks like there are some empty spaces before the 1s with decreasing order.
Good luck
+ 1
Here is the program to print a pattern like this
1
12A
123AB
1234ABC
https://code.sololearn.com/cLN62cj2WQtv
This program is similar to start pyramid pattern program https://www.techcrashcourse.com/2016/01/print-equilateral-triangle-pyramid-star-pattern-in-c.html but instead of printing star characters in a row, you need to add following check to print Alphabets
if (star < i+1) {
printf("%d", star + 1);
}
else {
printf("%c", 'A' + k);
k++;
}
I found this link very useful in solving your problem https://www.techcrashcourse.com/2016/02/c-program-to-print-triangle-pyramid-star-pattern.html . Hope it helps.
0
link for code getting problem on first line of output