https://ide.codingblocks.com/s/150633 This is my code. It is not working for very large numbers even though I have used long long int. What should I change? And also which data type is bigger – long long int or long double?
Two test cases giving wrong answer
Your code is correct, only change the size everywhere to 90000000, rather than wht u have used in your code, and then try to submit the code.
1 Like
Thank you, that worked! Can you please explain why the range had to be extended to 90000000? And why was the code with lesser range not working? Because in the question the given range was 5000000.
Actually, in the question it is given that n is 1<=n<=5000000, but if u consider the suppose the 5000000th prime no, it wont be printed since the value of that prime no will definitely be greater than 5000000, thus Use that value only.
1 Like