Printing all prime numbers between 3-100 in C++
<p>I have code here for the program to list all prime numbers from 3-100. My main problem is that the program only prints out three. I think for some reason it's leaving the loop or something. I put a break within the for statement for it to leave the inner for loop immediately once it finds that the number is not prime so that it can print it out. But, it doesn't seem to be working.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;conio.h&gt;
#include &lt;cmath&gt;

using namespace std;

int main()
{

bool prime = true;

for (int x = 3; x &lt;= 100; x++)
{
for (int y = 2; y &lt;= (x - 1); y++)
{
    if ((x % y) == 0)
        prime = false;
        break;
}

if (prime == true)
    cout&lt;&lt;x&lt;&lt;endl;
}

getche();
return 0;
}
</code></pre>
