title: Sum of prime numbers less than 2 million
body: <p>I am trying to solve a Project Euler problem, it wants me to find the sum of prime numbers below 2 million. Here is the code I wrote : </p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  bool isPrime (int x)
  {
      for(int i = 2; i &lt; x; i++)
      {
          if(x % i == 0)
              return false;
      }
      return true;
  }
  int main ()
  {
  
      int x = 0;
      for(int i = 3 ; i &lt; 2000000;i++)
      {
          if(isPrime(i))
              x = x + i;
      }
  
  
  cout&lt;&lt;x+2&lt;&lt;endl;
  }
  </code></pre>
  
  <p>I know this is not an efficient way to solve this problem. I found an easier way but I think this solution should give the correct answer too. The answer this code finds is : 1179908154. Can you tell me why this code is giving the wrong answer? </p>