Question: Create a conditional and looping statements using Java Language. Kindly refer to the sample output provided above. 1. Create a program that allows the user

 Create a conditional and looping statements using Java Language. Kindly refer

Create a conditional and looping statements using Java Language. Kindly refer to the sample output provided above.

1. Create a program that allows the user to input a positive integer. If the number is even, divide it by 2 and if it's odd, add 1 and divide it by 2 then print every value until it reaches the value of 1. Display the number of processes performed to make it down to 1. Sample Output: run: D D run: enter a positive integer: 85 enter a positive integer: 86 86 43 21 43 21 10 5 2 1 Actions performed: 7 10 5 2 1 Actions performed: 6

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!