Question: Write a program that reads from the keypad an integer and calculates the following: If the number given by the user is even, then divide
Write a program that reads from the keypad an integer and calculates the following: If the number given by the user is even, then divide it by 2. If it is an odd number, multiply it by 3 and add 1.The program should repeat this procedure for the calculated new result (which will be printed on the screen) until it reaches number 1. The program will also need to print out how many steps it took overall.(C programming language)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
