CJCoding With Joseph
15free / daySign inCreate account

Build a modular program using a helper function. Write two functions:

1) bool isPrime(int n) that returns true if n is prime (n must be at least 2 and have no divisors other than 1 and itself). 2) int countPrimes(int limit) that returns how many numbers from 2 up to and including limit are prime. It must USE isPrime.

Do NOT write a main function.

Expected output

4
8

= newline. The output ends with a newline, so print one after the last line.

Hints4 available
Topics
Modular Programming
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your output

Run your code to see the output here...

Test cases

Run your code to see test case results.