Question: c++ program please You will implement in this exercise an ancient Greek algorithm for finding the prime numbers less than a given number. Reminder: A
c++ program please

You will implement in this exercise an ancient Greek algorithm for finding the prime numbers less than a given number. Reminder: A prime number is a positive integer greater than 1 that is divisible only by itself and by 1. Here is how the algorithm works assuming we would like to find the prime numbers 1 are assumed to be prime 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 1 1 18 19 20 Iteration 1: mark all the multiples of 2 as not prime Array: 0 0 1 1 0 1 0 1 0 1 0 1 0 1 Index: 0 1 3 4 5 6 7 8 9 10 11 12 13 14 1 1 0 0 1 16 17 15 18 19 20 Iteration 2: mark all the multiples of 3 as not prime Array: 00 1 1 0 1 0 1 0 0 0 1 0 1 0 Index: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 0 1 15 16 17 1 18 19 20 Iteration 4: mark all the multiples of 5 as not prime (4 is skipped) Array: 0 1 1 0 1 0 1 0 0 0 1 0 1 0 0 1 Index: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 0 18 19 20 Etc. Requirements. 1. Implement function void SetMultiples(int a[], int size, int num) which marks all the multiples of num in the array as not prime (excluding num). 2. Write a program that prints the prime numbers
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
