title: Code unexpectadly giving an infinite loop
body: <p>Recently started learning C++ and i wrote a simple program that defines is the given number prime or not, and when the input is zero, it finishes. But i accidentally noticed that it creates an infinite loop when the input is somewhere between 2100000000 and 2200000000. I don't know why this happens, can you please explain to me?</p>
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int number, i, k;
  
  int main()
  {
      do
      {
          cin &gt;&gt; number;
          if (number == 0)
              break;
          for (i = 2; i &lt; round(sqrt(number)) + 1; i++)
              if (number % i == 0)
                  k++;
          if ((number == 1) || (k &gt; 0))
              cout &lt;&lt; &quot;This number is not prime\n&quot;;
          else
              cout &lt;&lt; &quot;This number is prime\n&quot;;
          k = 0;
          i = 0;
      } while (!(number == 0));
  }
  </code></pre>