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

Help me :)

1. Write a program that will ask the user a number. 1a. Number should be greater than 20 and less than 100,000. The program should warn the user if this restriction is violated and should ask again. 1b. Non-number inputs should not result into program crashing. 2. If the number is even, the program should divide it by 2. If the number is odd, multiply it by 3 and add 1. 3. The program will repeat this again with the resulting quotient or sum, and will repeat again until the number becomes 1. 4. All quotients or sums should be displayed. 5. All numbers, including the one entered by the user, should be added in a list. 6. At the end of the computation, the program will display this list of numbers.

31st Mar 2017, 9:23 AM
riame perfas
riame perfas - avatar
2 Answers
+ 3
What did you try so far and where did you get stuck?
31st Mar 2017, 9:43 AM
Tob
Tob - avatar
+ 1
I recommend use only 10 fingers, more fingers is overkill.
31st Mar 2017, 9:27 AM
nextco
nextco - avatar