Question PSC-LOOP-0066
HardWhat will be the output of the following pseudocode?
Integer n = 12345, r = 0, s = 0
while (n > 0)
Integer d = n mod 10
if (d mod 2 == 0)
s = s + d
else
r = r * 10 + d
end if
n = n / 10
end while
Print r, s
- A.
135 6
- B.
531 9
- C.
Sign up free to see the answer and a step-by-step explanation.