title: Does this program have a limit?
body: <p>I am having a problem with this code. Although it should say that this number is not prime, as i put a ridiculously large number that i know to be nonprime (252345435465, or even 1000000000000 as an example), it states that the number is prime.</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;cmath&gt;
  
  using namespace std;
  
  int main() {
  int n;
  int i;
  int prime = true;
  
  cout &lt;&lt; "Type in a number and press ENTER: ";
  cin &gt;&gt; n;
  
  i = 2;
  while (i &lt;= sqrt(n)) {
      if (n % i == 0) {
          prime = false;
          break;
      }
      i++;
  }
  
  if (prime)
      cout &lt;&lt; "The number is prime" &lt;&lt; endl;
  else
      cout &lt;&lt; "The number is NOT prime" &lt;&lt; endl;
  
  system("PAUSE");
      return 0;
  }
  </code></pre>
  
  <p>Is there something I'm doing wrong?</p>