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
Ket [755]
3 years ago
10

Write an expression that executes the loop body as long as the user enters a non-negative number. Note: If the submitted code ha

s 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. Sample outputs with inputs: 9 5 2 -1 Body Body Body Done.
Computers and Technology
1 answer:
Mama L [17]3 years ago
8 0

In the program While loop is used. In the while loop it divides the userNum by 2 in each iteration and prints the value of userNum. The inputs and corresponding outputs are written in the explanation.

<u>Explanation</u>:

In the while loop it divides the userNum by 2 in each iteration and prints the value of userNum.

import java.util.Scanner;  

public class NonNegativeLooper

public static void main (String [] args)

Scanner scnr = new Scanner(System.in);  

//initialize the userNum with 9

int userNum = 9;

//Repeat the loop until the userNum is not negative

while (userNum>=0)

System.out.println(Body);

//Prompt the user to enter the usrNum again

userNum = scnr.nextInt();

System.out.println(Done.);

return;

You might be interested in
What are the pros and cons of being a single decision maker
Alecsey [184]

Answer:

Single-decision maker tends to benefit from the autonomy to take decisions and make required amendments, whereas the disadvantages include that there may be bias and efficiency could have been improved.

Explanation:

5 0
3 years ago
What is Human Dignity
jeyben [28]

Answer:

what is human dignity

Explanation:

The English word dignity comes from the Latin word, dignitas, which means “worthiness.” Dignity implies that each person is worthy of honor and respect for who they are, not just for what they can do. ... In other words, human dignity cannot be earned and cannot be taken away.

6 0
3 years ago
3. What term refers to the physical locations of elements in relation to each other?
erik [133]

The answer for the first one is proximity.

The term proximity means “closeness”. The relationship between each other can be described by proximity only. All the other options are invalid.

The answer for second one is “alignment”.

Alignment actually relates to the term margin and axis. Alignment can be left, right, middle, top, bottom. Text, image, or any element can be aligned based on the need with the value of alignment discussed in the just before sentence. Alignments are widely used in computer terms in office tools and in web pages.

6 0
3 years ago
Read 2 more answers
When we insert a new node into a red-black tree, we set the color of the newly inserted node n to red. observe that if we had ch
Vika [28.1K]
Cause u didnt want to
4 0
3 years ago
Why is a computer called"a computer"?​
sleet_krkn [62]

Answer:

because it was originally given to humans (himan computers) who performed numerical calculations using mechanical calculators.The term was later given to mechanical devices as they began replacing human computers.

4 0
2 years ago
Read 2 more answers
Other questions:
  • Helllllp: Virtual private networks require a secure remote connection.<br> True or False?
    10·2 answers
  • What is the input output ratio if its 12/23
    7·1 answer
  • Documents on the web stored on web servers are known as web _____.
    6·1 answer
  • Monitors display images by using a grid made up of millions of tiny dots, called ________.
    13·1 answer
  • Steps in the systems development life cycle​
    15·2 answers
  • Whats a field in databases?
    5·1 answer
  • Match the component to its function. resistor inductor capacitor battery transistor This component stores a temporary charge. ar
    7·2 answers
  • Some one help pls will mark brainless !!!!!
    13·1 answer
  • I ONLY HAVE 5 MIN HELPPPPPP
    15·2 answers
  • Computer always produces wrong output true or false<br>​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!