How to store prime numbers in an array after SoE?

Use an array to store the prime numbers seive and use it only once, before you take the input, and after that maintain a counter which will check if cnt==nth no, then print i and break the loop