Question PSC-FUNC-0068
HardWhat does the following pseudocode print?
Function rev(Integer n, Integer acc)
if (n == 0)
return acc
end if
return rev(n / 10, acc * 10 + n mod 10)
End Function
Integer x = 12321
if (rev(x, 0) == x)
Print "palindrome", rev(1200, 0)
end if
- A.
palindrome 0021
- B.
palindrome 1200
- C.
palindrome 21
- D.
21
Sign up free to see the answer and a step-by-step explanation.