Question PSC-ARR-0053
MediumWhat will be printed by the following pseudocode?
Integer a[5] = {2, 7, 11, 15, 20}
Integer i = 0, j = 4, target = 22
while (i < j)
if (a[i] + a[j] == target)
break
else if (a[i] + a[j] < target)
i = i + 1
else
j = j - 1
end if
end while
Print a[i], a[j]
- A.
7 15
- B.
11 11
- C.
Sign up free to see the answer and a step-by-step explanation.