- 1

I too know of using continue and break statements let take a example of prime number 555643 to check it is prime are not loop sh

I too know of using continue and break statements let take a example of prime number 555643 to check it is prime are not loop should be used efficienctly

28th Apr 2017, 4:08 PM
tharun
tharun - avatar
1 Resposta
+ 9
if the number is divisible, break the loop. for(int i = 3; i <= Math.sqrt(555643); i+=2) if(555643 % i == 0) break; // is prime, lets get outa here
28th Apr 2017, 6:19 PM
Rrestoring faith
Rrestoring faith - avatar