中等ICT-ALGO-006
What is the output of this pseudocode? n ← 1; WHILE n < 8; n ← n * 2; END WHILE; OUTPUT n
A. 1
B. 4
C. 16
D. 8✓ 答案
解說
n goes 1, 2, 4, 8. When n is 8 the condition n < 8 is false, so the loop stops and 8 is output. It does not multiply once more to 16.