title: C++ code for checking for prime numbers not working
body: <p>I'm having trouble with this C++ code. The integer <code>num</code> is a number that I want to check if it is prime. However this program is always returning false. It's probably something simple but I can't find anything.</p>
  
  <pre><code>for(int i=2;i&lt;num;i++){ //primes are allowed to be divided by 1 so we start at 2
          if(num % i == 0){ //can be divided by a number other than itself or 1 so we trip out
              return false;
          } else if(i == num){ //if we've already done checks as high as possible and not tripped out yet then report success
              return true;
          }
  }
  </code></pre>