+ 1

What is Logic for check prime no. ?

give answer

21st Sep 2017, 9:02 AM
Amol Ghadge
3 odpowiedzi
+ 11
A number is prime if it is larger than 1 and can only be divided evenly by 1 and itself.
21st Sep 2017, 9:46 AM
Hatsy Rei
Hatsy Rei - avatar
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
21st Sep 2017, 3:09 PM
Humberto da Silva Neto
Humberto da Silva Neto - avatar
0
https://code.sololearn.com/c6sos0V3zH3W/?ref=app
21st Sep 2017, 3:37 PM
Moustafa Shahin
Moustafa Shahin - avatar