Learn to Code
John F. Dumas
contact me | resume | how it works | example programs | testimonials | main page

C++ - Primes


► Problem Description: Write a c++ program that can output all the prime numbers up to a given value of 'N' without using loops, division or the modulus operator.


► Example Output:

Here's a list of the first 15 primes. The program that generated this list used recursion and the sieve of eratosthenes to produce its results within the stated restrictions.

2
3
5
7
11
13
17
19
23
25
29
31
37
41
43


Source code


Back to Example Program Index


© John F. Dumas | johnfdumas@gmail.com | main page | top of page