Question PSC-FUNC-0035
EasyWhat will be printed by the following pseudocode?
Function steps(Integer n)
if (n == 1)
return 0
end if
if (n mod 2 == 0)
return 1 + steps(n / 2)
end if
return 1 + steps(3 * n + 1)
End Function
Print steps(6)
- A.
8
- B.
16
- C.
Sign up free to see the answer and a step-by-step explanation.