Regarding this topic, we'd already done the program code..but we are not sure whether our solution/code satisfy the theory of the sieve of eratosthenes..?could anyone pls verify it for us..that we'd done the right steps???tq..
for( division = counter + 1; division < SIZE; division++ )// checks if it is divisible other than 1 or itself.
if( !(division % counter) ) // if not then set as 0.
prime_num[ division ] = 0;
for( counter = 2; counter < SIZE; counter++ )// print all the prime subscripted, that are initialized to 1.
if( prime_num[ counter ] )
{
color(11);
printf("%d\t", counter);
}
color(9);
I would say no, with the sieve you don't need to check if the number is prime. Just iterate over the array and for each index that is set prime set all multiples not prime.