Question: c programming Exercise:4 Read a positive integer value, and compute the following sequence: If the number typed is less than 1. print wrong input. If

c programming
Exercise:4 Read a positive integer value, and compute the following sequence: If the number typed is less than 1. print wrong input. If it is 1, print initial value 1, no processing 53 For values greater than 1; if the number is even, halve it if it is odd, multiply it by 3 and add 1 to it. Repeat this process until the value is 1, printing out each value. Finally print out how many of these operations you performed. Dalle-363 002 wurkarna, te Enter an integer value > to 1 --1 Wrong input Press any key to continue 2 Dics-102.07 workorealabo IX Enter an integer value >: to 1 initial value 1. no processing Press any key to continue 1 1 D:\11-107_097 werkurela Enter an integer value >: to 1 initial value :6 Next value :3 Next value :10 Next value 5 Next value :16 Next value : 8 Next value 4 Next value 2 Next value :1 number of steps: 8 Press any key to continue De 107 092 work area ta.. Enter an integer value >: to 7 initial value :7 Next value :22 Next value :11 Next value :34 Next value 17 Next value 52 Next value 26 Next value :13 Next value : 40 Next value 20 Next value :10 Next value :5 Next value :16 Next value : 8 Next value : Next value 2 Next value: 1 number of steps: 16 Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
