cont int MAX = 10005;
bool isPrime[MAX];

void sieve()
{
    int lim=sqrt(MAX);

    /* Initially Mark all numbers as Prime */
    for(int i=2;i<MAX;i++)
        isPrime[i]=1;

    for(int i=2;i<=lim;i++)
        if(isPrime[i])    /* for each Prime */
            for(int j=2*i;j<MAX;j+=i)    /* Cross out all multiples of i */
                isPrime[j]=false;
}


On Mon, Mar 21, 2011 at 5:41 PM, rohit <scofiel...@rediffmail.com> wrote:

> i just want to know , when we make a program how update array after
> deleting alternate element.
>
> On Mar 21, 4:37 pm, Anurag atri <anu.anurag....@gmail.com> wrote:
> > what did you not understand in this ?
> >
> > On Mon, Mar 21, 2011 at 4:59 PM, rohit <scofiel...@rediffmail.com>
> wrote:
> > > genrate prime number using Sieve of Eratosthenes method
> > > explanation is herehttp://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
> > > pls help me out
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Algorithm Geeks" group.
> > > To post to this group, send email to algogeeks@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > algogeeks+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/algogeeks?hl=en.
> >
> > --
> > Regards
> > Anurag Atri
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to