title: Output wrong Project Euler 7
body: <p>So I'm trying out Problem 7 of Project Euler. </p>
  
  <p>By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
  What is the 10 001st prime number?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  using namespace std;
  
  bool isPrime(int a){
      if (a==2||a==3){
          return true;
      }
      if (a%2==0){
          return false;
      }
  
      bool prime=true;
      for (int b=2;b&lt;sqrt(a);b++){
          if (a%b==0)
              prime=false;
  
      }
      if (prime==true)
          return true;
      else 
          return false;
  }
  
  int main(){
      int infinite=0;
      long long int primecounter=0;
      for (int c=2;infinite==0;c++){
          if (isPrime(c)==true){
              primecounter++;
              //cout&lt;&lt;c&lt;&lt;endl;
              if (primecounter==10001)
                  {cout&lt;&lt;c;
  
              break;}
          }
      }
      return 0;}
  </code></pre>
  
  <p>This is what I've come up with so far. It works for the few numbers that I tested, like the 6th prime number etc. However, when I run it for the 10001st prime, it gives me 104021, and the answer is wrong. Can someone tell me what is wrong with my code?</p>