Question: using c++ programs library 16. Write a program that will read an integer number from the user. Then according to the number do 1. If

 using c++ programs library 16. Write a program that will read

using c++ programs library

16. Write a program that will read an integer number from the user. Then according to the number do 1. If the number less than 1, print "wrong input" 2. If the number is equal to 1, print "initial value is 1, no further processing" 3. If the number is even divide it by 2, if the result is odd or the number itself is odd multiply it by 3 and add 1 Repeat the process until the value is 1 Print out each value and how many steps you have done. Below sample runs are showrn Enter an integer value: -3 rong Input Press any key to continue . Enter an integer value: 1 Initial value 1s 1. no further processing Press any key to continue .. . Enter an integerr value 9 Initial value: 9 Next value: 28 Next value: 14 Next value: ? Next value: 22 Next value 11 Next value 3 4 Next value 17 Next value 52 Next value: 26 Next value 13 Next value 40 Next value 20 Next value 1G Next value: 5 Next value: 16 Next value: 8 Next value 4 Next value 2 Next value 1 number of steps = 20 Press an y ke y to continue Enter an integer value: 5 nitiall valuLe Ne xt value 16 Next value: 8 Next value 4 Next value: 2 Next value1 number of steps6 Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!