TLE and Wrong Ans?

I am getting TLE in one TC and wrong ans in another ?

https://ide.codingblocks.com/s/141680 This is the link i think.

@namandubey20 this question requires the knowledge of a particular concept called Sieve of Eratosthenes, which is covered under the Number Theory section.
I’d have to ask you to hold on to this question until you reach that section in the course. Meanwhile, you can try other topics.

But why i am getting wrong answer in 1 TC? I have tried different TCs but the code is working fine. Than which TC is giving wrong ans ?

@namandubey20 It is because you are using t as a flag variable. When the value of t is 0 from the while loop, in that case also the value of s will get incremented.
Use another variable as a flag instead of t.

Still getting wrong answer.

I’d recommend you to first go through the Sieve of Eratosthenes then attempt this question.

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.