sieve of eratosthenes c

[ad_1]

sieve of eratosthenes c
/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include 
#include 
#include 

int main()
{
    int n,i,j; //declaring required variables
    scanf(
    bool arr[n+1]; //declaring an array which contains true and false values
    arr[1]=false; //setting the first index to false (1 is not a prime number)

    for(i=2;i<=n;i++){
        arr[i]=true; //we are assuming that all the numbers are true which means prime
    }

    for(i=2;i

[ad_2]

Please follow and like us:
Content Protection by DMCA.com