I submitted the following code:
https://ide.codingblocks.com/#/s/12957
for the following problem:
https://hack.codingblocks.com/contests/c/474/157
The Online Judge say that time limit exceeded.
Please help!What are the problems in my code?
I submitted the following code:
https://ide.codingblocks.com/#/s/12957
for the following problem:
https://hack.codingblocks.com/contests/c/474/157
The Online Judge say that time limit exceeded.
Please help!What are the problems in my code?
The Problem you are facing is because in the for loop you have used i again instead of j
for(i=2;j<i;j++) should be replaced with for(j=2;j<i;j++) .
And also you are not taking input you are just trying to print every prime number between 1 and 1000.
https://ide.codingblocks.com/#/s/12958
go through the link to see fully commented correct code
Thank you so much for your help!