Question PSC-ARR-0067
HardWhat will be the output of the following pseudocode?
Integer a[6] = {2, 7, 4, 1, 8, 1}
Integer i, best = 0, minSoFar = a[0]
for (each i from 1 to 5)
if (a[i] - minSoFar > best) best = a[i] - minSoFar end if
if (a[i] < minSoFar) minSoFar = a[i] end if
end for
Print best
- A.
6
- B.
8
- C.
Sign up free to see the answer and a step-by-step explanation.