The following prime numbers are printed out by this C++ code: 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 73 79 83 89 97.
However, I don't believe that is how my book would prefer it to be written.
It makes a reference to the square root of a number.
I thus tried switching my second loop to for (int j=2; jsqrt(i); j++), but it did not produce the desired outcome.
How would I modify this code to make it the way my book desires it to be?
int main ()
{
...READ MORE
Aug 23, 2022
in C++
by
Nicholas
• 7,760 points
edited
Mar 4
•
68 views