Question PSC-LOOP-0079
HardWhat is the output of this pseudocode?
Integer count = 0, n
for (each n from 1 to 50)
Integer m = n, s = 0
while (m > 0)
s = s + m mod 10
m = m / 10
end while
if (s == 5)
count = count + 1
end if
end for
Print count
- A.
5
- B.
10
- C.
Sign up free to see the answer and a step-by-step explanation.