static void Main(string[] args) { PrimeNumber PNumber = new PrimeNumber(); long sum = 0; int limit = 2000000; for (int i = 2; i <= limit; i++) { if (PNumber.isPrime(i)) { sum += i; } } Console.WriteLine("Sum of numbers below 2000000 is " + sum); Console.ReadLine(); }