Sieve of Eratosthenes Algorithm C Program

C Program To Implement Sieve of Eratosthenes Algorithm

Learn How To Find Prime Numbers using Sieve of Eratosthenes Algorithm in C Programming Language. This code includes a Sieve Method For Prime Numbers in C Language using Array.


This program uses Sieve Function in C that prints all the Prime Numbers within the given range. The Sieve of Eratosthenes Method is a highly efficient algorithm to find Prime Numbers in a given range where the limit can extend upto 1 Million. The Time Complexity for the Sieve Method to Find Prime Numbers in a given range is total time complexity is O(n * log ( log n)).

Example

Prime Numbers Till 10

2 3 5 7

Must Read: C Program To Find Prime Numbers using Normal Method


C Program For Sieve of Eratosthenes Algorithm using Array

Must Read: C Program To Solve Tower of Hanoi Problem without Recursion

Output

C Program For Sieve of Eratosthenes Algorithm using Array

If you have any compilation errors or doubts in this Code For Sieve of Eratosthenes Algorithm in C Programming Language, let us know about in the Comment Section below.

Tushar Soni

I am Tushar Soni, Co - Founder of CodingAlpha. I am a computer science student from India and passionate about Web Development and Programming. Connect with me on Facebook | LinkedIn | Google Plus

2 thoughts on “Sieve of Eratosthenes Algorithm C Program

  • August 20, 2016 at 11:48 pm
    Permalink

    Can we not use the simple method to print prime numbers using for loop instead of going for sieve of eratosthenes which is both difficult to pronounce as well as to write?

    Reply
    • August 21, 2016 at 12:14 am
      Permalink

      I agree with you. Using For Loop in the Prime Numbers Program is comparatively easier but this sieve method for printing prime number has advantage with Memory and Execution time which is given more priority in realtime systems.

      Reply

Join The Discussion