1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
UkoKoshka [18]
3 years ago
8

In 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 = 20:

Computers and Technology
2 answers:
professor190 [17]3 years ago
8 0

Answer:

public class HelloWorld{

    public static void main(String []args){

       

        int userNum = 20;

       

        while(userNum!=1){

            userNum = userNum/2;

             System.out.print(userNum+" ");

        }

    }

}

Explanation:

Create the main function and declare the variable userNum with value.

then, use a while loop and it run until the userNum not equal to one when it become equal to 1 the while loop terminate.

Inside the loop, divide the userNum by 2 and then assign to userNum and this process continue until condition  true.

for example:

userNum = 20

userNum =20/2=10

then, 10/2=5

5/2=1

after that condition false. and while loop terminate.

Arturiano [62]3 years ago
8 0

Answer:

while(userNum > 1){

        userNum = userNum /2;

        System.out.print(userNum+" ");

     }

Explanation:

Probably don't need the print statement, but it doesn't cause an error.

You might be interested in
Which tools allows you to see the edition, version and memory use by windows 10?
cricket20 [7]

Answer:

Resource Monitor

Performance Monitor

Computer Management and Administrative Tools

Advanced User Accounts Tool

Disk Cleanup

Local Group Policy Editor

There is alot do u want them all?

6 0
3 years ago
Driving is expensive. Write a program with two inputs, a car's miles/gallon and the cost of gas/gallon both represented as doubl
Nataly_w [17]

Answer:33

Explanation:

6 0
3 years ago
The collection of all component frequencies iscalled _____________
yKpoI14uk [10]

Answer:

The answer is Frequency Spectrum.

Explanation:

The frequency spectrum is range of all component frequencies.It contains all the waves which are as following:-

Gamma Rays

X-Rays

Ultraviolet

Visible light.

Infrared

Micro wave

Radio wave

These all waves have their range of frequencies.The waves that are visible to us is only the visible light.

4 0
3 years ago
Pleas pleas help and get 99 points with brainliest
storchak [24]
When you copy cells, cell references automatically adjust. But, when you move cells, cell references are not adjusted, and the contents of those cells and of any cells that point to them may be displayed as reference errors. In this case, you have to adjust the references manually.

If the selected copy area includes hidden cells, rows, or columns, Excel copies them. You may have to unhide data temporarily you don't want to include when you copy information.

Hope this helps! I'm not a computer genius though
5 0
3 years ago
Read 2 more answers
How many warnings do u get before you like lose your account?
Step2247 [10]

Answer: 5 warnings untill your account is gone.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Transparency is an important concept in policies related to the handling and use of customer data. Organizations should be trans
    5·1 answer
  • Write a program using nested loop to produce the following output:
    6·1 answer
  • Describe and compare imperative (C), functional (SML) and logic (Prolog) programming paradigms.
    9·1 answer
  • After adjusting your seat, your _____ should be as close as possible to the backrest
    7·2 answers
  • Plz tell me how to get my deleted account back you will be highly PRAISED!!!!!!!!!!
    14·2 answers
  • What will be displayed after code corresponding to the following pseudocode is run? Main Set OldPrice = 100 Set SalePrice = 70 C
    10·1 answer
  • Define global variables called highestNum, userInput and sumOfNums and initialize them. In Main call 2 methods: 1) UserData() 2)
    5·1 answer
  • Which statements about editing an existing Contact in Outlook are true? Check all that apply.
    9·2 answers
  • How does Python recognize a tuple?
    12·1 answer
  • Which of the following statements best illustrates how value was created for eggs? when a farmer sells a chicken who is no longe
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!