121k views
2 votes
Which of the following while clauses will stop the loop when the value in the age variable is less than the number 0?

2 Answers

4 votes

Answer:

age is just a number dont be defined

Explanation:

User Trinadh Thatakula
by
4.5k points
5 votes

The clause which will stop the loop when the value in the age variable is less than 0 is while age >= 0; Option (B) is correct.

The while clause follows the syntax ;

  • While (condition) (statement to execute)

While the condition in the While clause is True, the loop will keep running until the condition is False.

This means that if we want our loop to stop when age variable is less than 0, Then the loop condition should negate it.

Hence, loop condition would be greater than equal to 0. while age >= 0; is the required clause.

Complete Question :

Which of the following while clauses tells the computer to exit the loop when in the age variable is less than the number 0?

while (age < 0)

while age >= 0;

while (age !> 0)

while (age >= 0)

User Kevin Nielsen
by
5.2k points