TestCase error in program of Prime Generator

Their is problem while executing the code that it shows error of :1) Timelimit and 2)run-error. While the same code is properly executed in eclipse

Your code may not be optimized, and may be incorrect for some corner case. While running code on your eclipse, hopefully you will be testing for small test cases, but on backend test cases are really huge.
Try to optimize your code, if failed to do so than plz save it on coding blocks ide and share the link.

Happy Learning. :blush:

How to share the wrong code on ide

Copy paste your code on cb.lk/ide and than click on save button, and than share the link.

Timit error is still occures

Your code’s time complexity is quite high. Try to read use sieve of eratosthenes, and use it to optimize your code.

Hope this helped.

How can I optimize the code

By using sieve of eratosthenes you can optimized your code.