Question: Program must be writing in C language as well as commented. Thanks! (1) (10 points) Prime numbers can be generated by an algorithm known as
(1) (10 points) Prime numbers can be generated by an algorithm known as the Sieve of Eratosthenes. The algorithm for this procedure is presented here. Write a program that implements this algorithm. Have the program find and display all prime numbers up to n = 150. Sieve of Eratosthenes Algorithm To Display All Prime Numbers Between 1 and n Step 1: Define an array of integers P. Set all elements Pito 0, 2 n, the algorithm terminates. Step 4: If P, is 0, then i is prime. Step 5: For all positive integer values of j, such that i *j s n, set Pyto Step 6: Add 1 to i and go to step 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
