What is wrong with the following while statement?

```
while (z >= 0)
{
sum += z;
}
```


The value of the variable z is never changed in the while statement. Therefore, an infinite loop occurs if the loop-continuation condition (z >= 0) is initially true. To prevent an infinite loop, z must be decremented so that it eventually becomes less than 0.

Computer Science & Information Technology

You might also like to view...

__________ ensures that only code, data, or stack segment descriptors are used and that they are used as intended.

a. Limit checking b. Type checking c. Memory protecting d. MMX technology

Computer Science & Information Technology

What is established by the following style sheet?table {border: solid 6px navy;}th, td {border: solid 2px orange;}

A. table borders B. a border around the table header C. gridlines D. both a and c

Computer Science & Information Technology

What four types of password restriction information are contained in a shadow file?

What will be an ideal response?

Computer Science & Information Technology

_________________ allows customers to both run existing applications and to develop and test new applications.

A. DaaS B. IaaS C. PaaS D. SaaS

Computer Science & Information Technology