Question PSC-LOOP-0064
HardWhat will be printed by the following pseudocode?
Integer n = 100, steps = 0
while (n != 0)
if (n mod 2 == 0)
n = n / 2
else
n = n - 1
end if
steps = steps + 1
end while
Print steps
- A.
9
- B.
10
- C.
Sign up free to see the answer and a step-by-step explanation.