0
Write an algorithm to check whether or not the given number is a prime number. Write the corresponding program in c++
3 Respuestas
+ 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
+ 6
https://code.sololearn.com/cFAESTxurVQn/?ref=app
Prime number C++
+ 2
In the code "isPrimeCode1" and "isPrimeCode2" are 2 ways of finding prime numbers.
https://code.sololearn.com/cpfUWe23IG3o/?ref=app