title: finding prime numbers c#
body: <p>the program should ask for a number and print all the primes numbers between 1 to the number the user entered... why isn't it working?</p>
  
  <pre><code>bool isPrime = true;
  int primes = 0;
  Console.WriteLine("Enter a number");
  int N = int.Parse(Console.ReadLine());
  for (int i = 2; i &lt;= N; i++)
  {
      for (int j = 2; j &lt;= Math.Sqrt(i); j++)
      {
          if (i % j == 0)
          {
              isPrime = false;
          }  
      }
      if (isPrime)
      {
          Console.WriteLine(i + " is a prime number");
          primes++;
      }
  }
  Console.WriteLine("Between 1 to " + N + " there are " + primes + " prime numbers");
  </code></pre>