Q:

Given the following loop:

0

 Given the following loop:

while x < 10

action

end

1. For what values of the variable x would the action of the loop be skipped entirely?

2. If the variable x is initialized to have the value of 5 before the loop, what would the action have to include in order for this to not be an infinite loop?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answers:

1/

The action would be skipped entirely if x is greater than or equal to 10 to begin with.

2/

The action would have to increment the value of x, so that eventually it becomes greater than or equal to 10. 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now