Question PSC-ARR-0003
EasyWhat will be the output of the following pseudocode?
Integer a[] = {3, 7, 1, 9, 4}
Integer m = a[0]
for (each i from 1 to 4)
if (a[i] > m)
m = a[i]
end if
end for
Print m
- A.
4
- B.
7
- C.
Show answer and explanation
Answer: C
m keeps the largest value seen, ending at 9.