+ 1
What is Logic for check prime no. ?
give answer
3 Respuestas
+ 11
A number is prime if it is larger than 1 and can only be divided evenly by 1 and itself.
0
try to divide this number by 2 and the odd numbers between 3 and sqrt( your number).
if the rest (of the division) of any of those division is 0, it is a prime number.
PS.: Do not divide the number by itself, because the rest of the division will be 0
https://code.sololearn.com/cHG049yX9kHx/?ref=app
0
https://code.sololearn.com/c6sos0V3zH3W/?ref=app