Mistake in the code for nth prime number

the above code is not giving any output what is the mistake ?the above is the code to calculate the nth prime number

@Rj.25 check this

sir my code worked when i changed max size as 100005 instead of 1000005. how to decide what max size to take for which datatype ? can we derive it or is there any chart to remember? whatever it is please provide it to me , i always get confused with what to take.

https://ide.codingblocks.com/s/288349 see this code to find the primes in an array it is not giving correct output for 13 why so where is the mistake?

@Rj.25 when you use arrays (specifically static) you can’t assign them large values so always use vector or dynamic array and most of the time in coding competitions array size will not be more that 2e5

sir please check the second code it is the code to print the primes in the array it is not working correct for 13 and some of its multiples why so where is the mistake?

@Rj.25 i dont think your code is working correctly at all. check for n 7 10 its not giving output dry run it

sir i can not find out the mistake please tell

@Rj.25 your code is too complex check this


simply 10 line code

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.