Question PSC-ARR-0058
MediumWhat is the output of this pseudocode?
Integer a[5] = {9, 4, 7, 2, 8}
Integer i, cnt = 0
for (each i from 1 to 3)
if (a[i] < a[i - 1] and a[i] < a[i + 1])
cnt = cnt + 1
end if
end for
Print cnt
- A.
2
- B.
0
- C.
Sign up free to see the answer and a step-by-step explanation.