Help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 4

Help

To write a program pattern 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

31st May 2021, 2:31 PM
Rahul Gupta
Rahul Gupta - avatar
9 Answers
+ 4
show your attempt also, your assignment is now my property
31st May 2021, 2:45 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 3
I see you have completed 7% of the C course, explore more to know about this
31st May 2021, 4:20 PM
Atul [Inactive]
+ 2
Rahul Gupta Hint: 1 - start a loop for (int i = 0; i < 5; i++) 2 - make a variable inside this loop and assign value like.. int k = 2 * i + 1; because your each line of pattern is length of 1, 3, 5, 7, 9 3 - take another variable l and assign value of i to l like.. int l = i; 4 - now start another loop inside first loop and your new loop will like this: for (int j = 0; j < k; j++) 5 - Now check condition inside new loop (mentioned in 4th step if (j <= k / 2) //increase l by 1 else //decrease l by 1 and after this condition print l with space like this: cout << l << " "; 6 - now add this line after new loop to print each line of pattern with new line cout << endl;
1st Jun 2021, 1:42 AM
A͢J
A͢J - avatar
+ 2
You are amazing thank so much
1st Jun 2021, 2:46 AM
Rahul Gupta
Rahul Gupta - avatar
+ 2
Rahul Gupta I don't have time to teach anyone but you have doubt then ask in QA. Pattern understading comes from practice.
1st Jun 2021, 3:05 AM
A͢J
A͢J - avatar
+ 1
Just go and google pattern programing . you will find thousands like that codes there
31st May 2021, 3:01 PM
Yash Wable 🇮🇳
Yash Wable 🇮🇳 - avatar
+ 1
Ok thank u for your help and advice☺️
1st Jun 2021, 3:06 AM
Rahul Gupta
Rahul Gupta - avatar
0
Can you pls teach me
1st Jun 2021, 3:02 AM
Rahul Gupta
Rahul Gupta - avatar
- 4
Pls😥😥
31st May 2021, 2:53 PM
Rahul Gupta
Rahul Gupta - avatar