Please look at the code

i am not getting the output,
please tell me the error
code : https://ide.codingblocks.com/s/213652

@Chhayansh
hello chhayansh,
image
it should be j+=i;

also store all primes in some vector or array and simply print nth prime from that array in O(1) time.

sir please do the necessary changes in the code…
i am able to do with vector but not with array

sir please do the necessary changes in the code… i am able to do with vector but not with array

you want code which uses array in place of vector to store primes ?

how can we do the same without making the new array

@Chhayansh if we have not been given multiple test cases here then we can do it just by counting till we get nth prime but since we have multiple cases we have to use extra array else it can give TLE.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.