Skip to main content

Prime Counter

Challenge on lesson: Checkpoint: Loops

Implement int count_primes(int limit) counting primes in [2, limit] (inclusive) using loops only. Also implement void program(void) printing exactly: `` primes under 10: 4 2 3 5 7 `` Line 2 lists the primes 2..7 space-separated (single spaces, no trailing space).

Difficulty: beginner

Back to lesson: Checkpoint: Loops