Question PSC-FUNC-0001
EasyWhat will be the output of the following pseudocode?
Function f(Integer n)
if (n <= 1)
return 1
end if
return n * f(n - 1)
End Function
Print f(5)
- A.
24
- B.
5
- C.
Show answer and explanation
Answer: C
f computes the factorial: 5 × 4 × 3 × 2 × 1 = 120.