Thank you soo much sir. Big helpSeriously? The comment lines on it are self explanatory.
1st loop initializes the array of bolean variables into the value "true" because at this point most likely they contain garbage values which is important for the next step.
2nd loop is where the Sieve mathematical algorithm happens. Just refer to the link the below for "
The Sieve of Eratosthenes" mathematical formula because that should be another topic entirely.
You do not have permission to view the full content of this post. Log in or register now.
3rd loop is there to count how many prime numbers there are by counting how many elements in the array of boolean "flags" which hold the value "true".
4th loop is just there to display all the prime numbers within the limit.
sir ano po yung purpose ng flags sir?Seriously? The comment lines on it are self explanatory.
1st loop initializes the array of bolean variables into the value "true" because at this point most likely they contain garbage values which is important for the next step.
2nd loop is where the Sieve mathematical algorithm happens. Just refer to the link the below for "
The Sieve of Eratosthenes" mathematical formula because that should be another topic entirely.
You do not have permission to view the full content of this post. Log in or register now.
3rd loop is there to count how many prime numbers there are by counting how many elements in the array of boolean "flags" which hold the value "true".
4th loop is just there to display all the prime numbers within the limit.