Answers for "optimal way to find prime numbers"

0

optimal way to find prime numbers

int main () 
{
    for (int i=2; i<100; i++) 
        for (int j=2; j*j<=i; j++)
        {
            if (i % j == 0) 
                break;
            else if (j+1 > sqrt(i)) {
                cout << i << " ";

            }

        }   

    return 0;
}
Posted by: Guest on May-07-2021

Code answers related to "optimal way to find prime numbers"

Browse Popular Code Answers by Language