What is wrong with the following while loop?


while ( sum <= 1000 )
sum = sum – 30;

a. The parentheses should be braces.
b. Braces are required around sum = sum – 30;.
c. There should be a semicolon after while ( sum <= 1000 ).
d. sum = sum – 30 should be sum = sum + 30 or else the loop may never end.


d. sum = sum – 30 should be sum = sum + 30 or else the loop may never end.

Computer Science & Information Technology

You might also like to view...

Printer technologies produce characters and graphics as a series of small dots.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The duplicate values can be hidden using the ________

A) characteristics B) property sheet C) controls property D) Layout view

Computer Science & Information Technology

A(n) ____________________, like any linked text or object, displays the address of its target page on the status bar.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

A ____________________ input field may be added to a form to set the maximum allowable upload file size.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology