Question PSC-FUNC-0071
HardWhat will be printed by the following pseudocode?
Function isPrime(Integer n, Integer d)
if (n < 2) return 0 end if
if (d * d > n) return 1 end if
if (n mod d == 0) return 0 end if
return isPrime(n, d + 1)
End Function
Integer c = 0, i
for (each i from 1 to 50)
c = c + isPrime(i, 2)
end for
Print c
- A.
25
- B.
15
- C.
Sign up free to see the answer and a step-by-step explanation.