Question PSC-ARR-0080
HardWhat is the output of this pseudocode?
Integer a[6] = {1, 0, 2, 0, 3, 0}
Integer i, w = 0
for (each i from 0 to 5)
if (a[i] != 0)
Integer t = a[w]; a[w] = a[i]; a[i] = t
w = w + 1
end if
end for
Print a[0], a[1], a[2], a[3], w
- A.
0 0 0 1 3
- B.
1 2 3 0 6
- C.
Sign up free to see the answer and a step-by-step explanation.