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 20:30
Column a of irma’s spreadsheet contains titles for each row, but her document is too big and will be printed three pages across. she wants to be sure that every page will be understood. what can irma do to with this problem?
Answers: 3
question
Computers and Technology, 23.06.2019 23:00
Lucas put a lot of thought into the design for his company's new white paper. he made sure to include repeating design elements such as color schemes and decorative images. his goal was to a.add symmetry b.create a unified publication c.provide consistency d.save money
Answers: 1
question
Computers and Technology, 24.06.2019 02:40
Has anyone seen my grandma shes been gone for 4 years already
Answers: 1
question
Computers and Technology, 24.06.2019 21:30
Jenny wants to create an animated short video to add to her website. which software will she use to create this animated video?
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
Questions on the website: 13722360