Challenge :- Write a program to input odd no.(n) of no.s i.e , n is odd and print it in to & fro form | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Challenge :- Write a program to input odd no.(n) of no.s i.e , n is odd and print it in to & fro form

You 1st need to sort the elements and then it in to & fro form, like pendulum moves. Eg: Enter the no. of elements you want to enter - 7 Input - 65,76,14,54,89,91,27 Output:- Sorted order - 14,27,54,65,76,89,91 To & fro form - 14 54 76 91 89 65 27 Here the elements are printed at the point where the bob of pendulum is momentarily at rest. If the no. of inputs are even ,"print invalid input".

24th Jan 2018, 10:34 AM
Mr.Curious
Mr.Curious - avatar
2 Answers
25th Jan 2018, 1:30 PM
LukArToDo
LukArToDo - avatar
24th Jan 2018, 11:29 AM
Cool Codin
Cool Codin - avatar