subject

JAVA Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow each number by a space. Example output for userNum = 40:
20 10 5 2 1
Note: These activities may test code with different test values. This activity will perform four tests, with userNum = 40, then with userNum = 2, then with userNum = 0, then with userNum = -1. See "How to Use zyBooks". .
Also note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds, and report "Program end never reached." The system doesn't print the test case that caused the reported message.
import java. util. Scanner;
public class DivideByTwoLoop {
public static void main (String [] args) {
int userNum;
Scanner scnr = new Scanner(System. in);
userNum = scnr. nextInt();

/* Your solution goes here */

System. out. println("");
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:30
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 2
question
Computers and Technology, 23.06.2019 14:00
In which job role will you be creating e-papers, newsletters and preiodicals
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
In the blank libreoffice writer document, to start the process of entering a date field into a letter, click on the insert menu. edit menu. file menu. fields menu.
Answers: 3
question
Computers and Technology, 25.06.2019 00:00
He computer component that disperses heat from the microprocessor to the cooling fan is a cooler thermometer heat sink
Answers: 1
You know the right answer?
JAVA Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follo...
Questions
question
Mathematics, 30.04.2021 22:20
question
Computers and Technology, 30.04.2021 22:20
question
Mathematics, 30.04.2021 22:20
question
Mathematics, 30.04.2021 22:20
question
Arts, 30.04.2021 22:20
question
Mathematics, 30.04.2021 22:20
Questions on the website: 13722359