Playing With Cards(in stack) Query

What is the problem in this approach?

Which approach Anushka?
Pass on your code please

Hi Anushka
Pls comment your code and tell me specifically what problem are you facing?


According to the question we need to iterate q times. Right?
If so, then I am not getting the right output.

Hi
int prime=findSeive(i);
You are trying to find 0th prime number and it is giving unexpected result.
findSeive(0) is giving 9999 as answer


i have changed the code but the output is not coming.
My doubt was do we need to iterate q times? if so is my approach right?