Please now give the correct code solution link
hey ur code has some problems,
the size of array is way to small to record all primes
u need the nth prime no & not run the loop till n , the nth prime no may be way beyond n.
declaring a array of size 100000001 would help solve the problem
i hve attached the code for ur refernce