Question PSC-LOOP-0061
HardWhat will be printed by the following pseudocode?
Integer n = 30, count = 0, i, j
for (each i from 2 to n)
Integer prime = 1
for (each j from 2 to i - 1)
if (i mod j == 0)
prime = 0
break
end if
end for
count = count + prime
end for
Print count
- A.
9
- B.
11
- C.
Sign up free to see the answer and a step-by-step explanation.