Please tellme in the given code of prime no why my 1 st code is giving tle while 2nd one is correct?
If its is giving TLE then you must use Optimized Prime Sieve. The must be a video on it in the number theory section of your course. Please refer that video first.