Can anybody see why the following piece of code does not provide the correct output for the calculation of the sum of all primes < 2 000 000?
Code:#include <stdio.h> #include <math.h> int isPrime(int numb) { int i, stop = 0; for (i = 2; !stop && i <= sqrt(numb); i++) { if (numb % i == 0) stop = 1; } if (!stop) return 1; else return 0; } int main() { int i, sum = 2; for (i = 3; i < 2000000; i += 2) { if (isPrime(i)) { printf("%i\n",i); sum += i; } } printf("%i\n", sum); return 0; }