Question PSC-LOOP-0048
MediumWhat is the output of this pseudocode?
Integer s = 0, i
for (each i from 1 to 20)
if (i mod 3 == 0 and i mod 5 == 0)
s = s + 100
else if (i mod 3 == 0)
s = s + 1
else if (i mod 5 == 0)
s = s + 10
end if
end for
Print s
- A.
126
- B.
145
- C.
Sign up free to see the answer and a step-by-step explanation.