Prime numbers sieve method not working for n>90000

In the question deepak and primes i have used the logic of prime sieve, but this method is not working for n>90000.I have also used long long int but still it produces output 0 for n>=100000

Hey @anishmittal make sure you are running sieve only once and make the seive array size 100000005, if it still doesnt work, please share your code through ide.codingblocks.com

Hey @anishmittal there were couple of mistakes in your code

  1. in the first for loop of sieve instead of i < n use i * i < n
  2. only run second loop when i is prime
  3. when count == n print the number no need to iterate further.

here is code with rectifications: