0

i have to define a function that tests number from 2 to 10000 to see if they are prime.

heres what i have so far.

```
#include <iostream>
#include <iomanip>
using namespace std;
bool find_prime(int);
int main ()
{
int i, counter =0;
bool test;
for (i =2; i <= 500; i++)
{
test = find_prime(i);
if ( test == true )
{
counter++;
cout << setw(6) << i << "\t";
}
}
cout << "\nThe total number of the prime numbers between 2 and " << i << " is " << counter << endl;
return 0;
}
bool find_prime (int m)
{
int temp, j;
for ( j = 2; j < m - 1 ; j++ )
{
temp = m % j;
if (temp == 0)
{
return false;
break;
}
else
{
return true;
break;
}
}}
```

but it only tests prime numbers until about 500 or so then it gets most of the numbers to be prime but it still includes non prime numbers for some reason. ANy ideaS?

thanks