Prime Numbers using Sieve of Eratosthenes: C Program

Published: 09 November 2020
on channel: Technotip
8,549
117

https://technotip.com/9436/prime-numb...

Implement in a c program the following procedure to generate prime numbers from 1 to 100. This procedure is called Sieve of Eratosthenes.

Step 1: Fill an array num[100] with numbers from 1 to 100.

Step 2: Starting with the second entry in the array, set all its multiples to zero.

Step 3: Proceed to the next non-zero element and set all its multiples to zero.

Step 4: Repeat Step 3 till you have set up the multiples of all the non-zero elements to zero.

Step 5: At the conclusion of Step 4, all the non-zero entries left in the array would be prime numbers, so print out these numbers.

C Programming Interview / Viva Q&A List
https://technotip.com/6378/c-programm...

C Programming: Beginner To Advance To Expert
https://technotip.com/6086/c-programm...

Join this channel to get access to perks:
   / @technotipdotorg  


Watch video Prime Numbers using Sieve of Eratosthenes: C Program online without registration, duration hours minute second in high quality. This video was added by user Technotip 09 November 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 8,549 once and liked it 117 people.