0

Write an algorithm to check whether or not the given number is a prime number. Write the corresponding program in c++

21st May 2017, 4:14 PM
RR2001
RR2001 - avatar
3 ответов
+ 8
You can check out fermat's little theorm and modulus arithmetics. Those two will help you to make a fully efficent prime number checker tht can check for very large values. I made one for C# (Yes, I know it is not in C++, but in order for you to learn, you have to code it yourself. This is not a place to give you answers for homeworks.) https://code.sololearn.com/cbo6WUTLeLp1/?ref=app
21st May 2017, 4:19 PM
Wen Qin
Wen Qin - avatar
+ 6
https://code.sololearn.com/cFAESTxurVQn/?ref=app Prime number C++
21st May 2017, 4:22 PM
Pixie
Pixie - avatar
+ 2
In the code "isPrimeCode1" and "isPrimeCode2" are 2 ways of finding prime numbers. https://code.sololearn.com/cpfUWe23IG3o/?ref=app
21st May 2017, 4:36 PM
Rrestoring faith
Rrestoring faith - avatar