Question PSC-ARR-0012
MediumWhat will be the output of the following pseudocode?
Integer a[] = {1, 2, 3, 4, 5, 6}
Integer e = 0, o = 0
for (each i from 0 to 5)
if (i mod 2 == 0)
e = e + a[i]
else
o = o + a[i]
end if
end for
Print e - o
- A.
-3
- B.
12
- C.
3
- D.
9
Sign up free to see the answer and a step-by-step explanation.