how to print following pattern in c++ ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

6th Jun 2022, 6:05 PM
Abhishek Shelar
Abhishek Shelar - avatar
4 Answers
+ 1
Do you have an attempt in which you tried to do so yourself?
6th Jun 2022, 6:17 PM
Justice
Justice - avatar
+ 1
Nice question! Looks like there are some empty spaces before the 1s with decreasing order. Good luck
6th Jun 2022, 6:56 PM
Kashyap Kumar
Kashyap Kumar - avatar
+ 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.
13th Jun 2022, 8:19 PM
Arun Kumar
Arun Kumar - avatar
0
link for code getting problem on first line of output
6th Jun 2022, 7:11 PM
Abhishek Shelar
Abhishek Shelar - avatar