Algorithms of Pattern printing programs on C and C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Algorithms of Pattern printing programs on C and C++

Hey guys,since I'm new to programming, i need suggestions on pattern printing programs. How do you devise the algorithm based on the patterns? how to find the logic behind it? please help

11th Jun 2017, 9:30 AM
Praveen kumar
Praveen kumar - avatar
2 Answers
+ 15
OK, this one is thought-provoking. A lot of times, programmers go directly into coding without realising what is going through their heads. This makes it hard for explanations to be made for specific tasks such as pattern printing. I'll try to put it as simple as possible. 0) Identify the pattern. - What does the pattern consist of? Numerical values? Mere symbols? In the former case, does the numbers resemble a sequence while forming the pattern? Is it a triangle, or a quadrangle? 1) Rows and columns. - How many rows and columns does the pattern contain? How many loops and their corresponding loop count that has to be used in order to print it? 2) Special conditions. (links back to 0) - What are the if-else conditions that can be implemented? Does it print a special symbol every 2 rows? Does it skip a column every 3 occurrence of a pattern? 3) Reference. - When you still can't get hold of the correct algorithm to print a certain pattern, get reference! Refer from other code samples. Not everyone is a genius who can sketch their own complex algorithm from scratch. Once you have read and understood a sample algorithm/code on pattern-printing, try printing your own patterns!
11th Jun 2017, 2:12 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
thanks a lot @Hatsy Rei
11th Jun 2017, 2:53 PM
Praveen kumar
Praveen kumar - avatar