How to find prime number. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to find prime number.

23rd Mar 2017, 11:51 AM
Fatihullah Noory
Fatihullah Noory - avatar
4 Answers
+ 8
Basically you check if a number x is a prime, by iterating through a loop from 2 to the square root of x and checking if the remainder (modulo) of a division of x by the iterated number is zero. If you find at least one such a case, the number is not prime.
23rd Mar 2017, 9:23 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
A prime number is a number greater than 1, whose only two whole-number factors are 1 and itself. there is a lot of algorithm to find prime number .. https://code.sololearn.com/cfq7NMFgUeyp/#cpp
23rd Mar 2017, 12:43 PM
Mohamed MotYim
Mohamed MotYim - avatar
0
a number that is divisible only by itself and 1 (e.g. 2, 3, 5, 7, 11)
23rd Mar 2017, 4:44 PM
Mahesh Prabhu
Mahesh Prabhu - avatar
0
Ok tnx from all my friends
23rd Mar 2017, 5:25 PM
Fatihullah Noory
Fatihullah Noory - avatar