Hi,
First of all please always use code tags:
http://www.cplusplus.com/articles/z13hAqkS/
It seems that particular error has nothing to do with the code:
https://stackoverflow.com/questions/25102799/process-terminated-with-status-255
Btw, I found this with a net search - something you should have done before asking a question. That is, unless you live in Nth Korea or Iran or somewhere with internet restrictions.
Your algorithm is very inefficient, if you try it with big numbers it will be terribly slow. Have a look on the wiki page, you will find better algorithms. Another is
https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Euler.27s_Sieve.
This is a question from Project Euler, the big thing to learn there is that brute force methods are not the way to go. One has to come up with a clever method of arriving at the answer. So it involves some research: wiki and Google are you best friends there.
Another thing is the use of
break
and
continue
, they only work for the inner most loop.
Instead of a
for
loop with a large value for the limit, consider a
while
loop with 10,001 as the limit.
for
loops are good when you know exactly how many times to loop.
Good Luck !!