Question: Write a program that asks the user to input a positive integer. The program should then repeatedly divide the input by 2 until the

Write a program that asks the user to input a positive integer. 

Write a program that asks the user to input a positive integer. The program should then repeatedly divide the input by 2 until the result is less than or equal to 1. The program should print out each intermediate result of the division. For example, if the user inputs 20, the program should output: 10.0 5.0 2.5 1.25 #Write your program in this cell for Exercise 2. # num int(input("Enter a positive integer: ")) # TODO: write the while loop that repeatedly divides the number by 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Algorithm Input the Positive Integer The user will be ... View full answer

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 Programming Questions!