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...

To create an OU, you must be a member of the Account Operators group

Indicate whether the statement is true or false

Computer Science & Information Technology

A common type of non-volatile memory is _____.

A. RAM B. SSD C. ROM D. HDD

Computer Science & Information Technology