subject

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: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:20
The reset circuit used on the four 3-bit counters analyzed in this activity reset the counts to zero (000). it makes sense for the up-counters to start at zero (000), but the down-counters should start at seven (111). what would you need to change so that the 3-bit binary down counter with j/k flip-flops you just created would reset to seven (111)?
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
Which of the following is not an enhancement to the standard wiki to make it more attractive for corporations? encryptionwork spacespermission toolspredictive text
Answers: 2
question
Computers and Technology, 24.06.2019 11:20
William travels a lot on business purpose. he needs to regularly communicate with his business partner. he also needs to send out weekly reports to his boss while he is traveling. which web-based application best suits william’s needs? (social media, webmail, wiki) is the best web-based application for william. he can access this application via the internet using a (digital cable, fax machine, web browser).
Answers: 1
question
Computers and Technology, 24.06.2019 18:30
After making a powerpoint presentation about a new line of clothing designs, henri notices that he used the word “gorgeous” on nearly every slide. what would be the  best  way to add more variety to his wording by using tools within powerpoint? using the thesaurus under the view tab, and then using the find dialog box to find and replace every instance of “gorgeous”using the spelling checker under the view tab, and then using the find dialog box to find every instance of “gorgeous” and change some of themusing the thesaurus under the review tab, and then using the find dialog box to find every instance of “gorgeous” and change some of themusing the spelling checker under the review tab, and then using the find dialog box to find and replace every instance of “gorgeous”
Answers: 2
You know the right answer?
Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow each...
Questions
question
Mathematics, 03.08.2019 01:30
Questions on the website: 13722360