Question PSC-ARR-0047
MediumWhat does the following pseudocode print?
Integer a[8] = {1, 2, 2, 3, 3, 3, 4, 4}
Integer i, c = 1
for (each i from 1 to 7)
if (a[i] != a[i - 1])
c = c + 1
end if
end for
Print c
- A.
8
- B.
4
- C.
Sign up free to see the answer and a step-by-step explanation.