What is wrong with the following code fragment? What are three distinct ways it could be changed to remove the flaw?
```
count = 50;
while (count >= 0)
{
System.out.println(count);
count = count + 1;
}
```
The loop is infinite because count initially is greater than zero, and continues to increase in value. The flaw can be removed by (1) decrementing rather than incrementing count, (2) initializing count to 0 and using, as the condition of the while loop, count <= 50, and (3) picking an upper limit and using, as the condition of the while loop, count <= upperLimit.
You might also like to view...
The command to copy files from one UNIX system to another is:
a: rcp b: rcopy c: copy copy d: cpy e: rfile
Which of the following is NOT an argument in the majority of database functions?
A) Field B) Dialog C) Criteria D) Database
Click the ________ list arrow in the Outline Tools group to show all only the headings assigned to a particular level.
A. Show Headings B. Show Level C. Collapse Level D. Level
A _____ ensures that the webpages in a website share a standard layout.?
A. ?site index B. ?template C. ?flowchart D. ?wireframe