i'm in a beginning c++ class and we have to write a program that finds all primes between 2 and 100 within a doubly nested loop. i feel like i'm really close but i think i've been doing it too long and can't figure out what i'm doing wrong......
help please?
int main ()
{
int i = 0;
int j = 0;
bool isPrime;
for (i = 2; i < 99; i++)
{
isPrime = true;
for (j = 2; j < i; j++)
{
if (i%j == 0)
{
isPrime = false;
break;
}
else
if (isPrime == true)
cout << i << endl;
}
}
return 0;
}