Question PSC-LOOP-0010
MediumWhat will be the output of the following pseudocode?
Integer n = 9875, s = 0
while (n != 0)
s = s + (n mod 10)
n = n / 10 // integer division
end while
Print s
- A.
29
- B.
28
- C.
Sign up free to see the answer and a step-by-step explanation.