Question PSC-LOOP-0046
MediumWhat is the output of this pseudocode?
Integer x = 100, steps = 0
while (x != 1)
if (x mod 2 == 0)
x = x / 2
else
x = 3 * x + 1
end if
steps = steps + 1
end while
Print steps
- A.
17
- B.
26
- C.
Sign up free to see the answer and a step-by-step explanation.