Question PSC-LOOP-0009
MediumWhat will be the output of the following pseudocode?
Integer n = 1234, rev = 0
while (n > 0)
rev = rev * 10 + (n mod 10)
n = n / 10 // integer division
end while
Print rev
- A.
10
- B.
4321
- C.
Sign up free to see the answer and a step-by-step explanation.