What is the value of balance after the following code is executed?int balance = 10;while (balance >= 1) {if (balance < 9) break;balance = balance - 9;}
查看答案
What balance after the following code is executed?int balance = 10;while (balance >= 1) {if (balance < 9) continue;balance = balance - 9;}
A. -1
B. The loop does not end
C. 0
D. 2
What is sum after the following loop terminates?int sum = 0;int item = 0;do {item++;sum += item;if (sum >= 4) continue;}while (item < 5);
A. 18
B. 17
C. 15
D. 16
Will the following program terminate?int balance = 10;while (true) {if (balance<9) continue;balance = balance - 9;}
A. No
B. Yes
Will the following program terminate?int balance = 10;while (true) {if (balance < 9) break;balance = balance - 9;}
A. No
B. Yes