Question PSC-ARR-0042
MediumWhat will be printed by the following pseudocode?
Integer a[5] = {3, 9, 2, 9, 5}
Integer first = a[0], second = -1, i
for (each i from 1 to 4)
if (a[i] > first)
second = first
first = a[i]
else if (a[i] > second and a[i] != first)
second = a[i]
end if
end for
Print first, second
- A.
5 3
- B.
9 3
- C.
Sign up free to see the answer and a step-by-step explanation.