Can anyone help me write this simple prime number program, i cant get it right
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/11753851/c-code-for-checking-for-prime-numbers-not-working">C++ code for checking for prime numbers not working</a>  </p>
</blockquote>



<p>The Instructions are:
A prime number is a number which is only evenly divisible by 1 and itself.  For this assignment you will find which numbers from 1 to n (where n is a user-specified number) are prime.
Ask the user for a number, n, greater than 1.
Use a loop to iterate on a variable, i, from 2 through n.  For each iteration, check all numbers from 2 through i to determine whether the number is prime.  If it is prime, print out i and the word "Prime".</p>

<p>This is what i have so far:</p>

<pre><code> #include&lt;iostream&gt;
 using namespace std;

 int main()
 {
   int i;
   int n;
   cout &lt;&lt; "Enter a number greater than 1" &lt;&lt; endl;
   cin &gt;&gt; n;

  bool isPrime=true;
  for(i=0; i&lt;=n; i++)
    {
      if (n%i == 0)
        isPrime=false;
    }
  if(isPrime == true)
  cout &lt;&lt; i &lt;&lt; " is Prime!" &lt;&lt; endl;

  return 0;
  }
</code></pre>
