Question PSC-LOOP-0019
HardWhat will be the output of the following pseudocode?
Integer count = 0
for (each n from 2 to 20)
Boolean prime = true
for (each d from 2 to n - 1)
if (n mod d == 0)
prime = false
end if
end for
if (prime)
count = count + 1
end if
end for
Print count
- A.
10
- B.
7
- C.
Sign up free to see the answer and a step-by-step explanation.