cpp
cpp copied to clipboard
Refactor Prime_number_check
I am creating a pull request for...
- [ ] New algorithm
- [x] Update to an algorithm
- [x] Fix an error
- [x] Other - Describe below
-
First I found a problem in the naming convention of the function. When I was writing the tests I found that the name is making me think that the function should return true if the number is prime. It returned false in reality which bothers me. So I changed the name in a more communicative one.
-
I've changed the algorithm so that will avoid using the break keyword.
-
I've changed the algorithm because it's returning that 1 is a prime number when it's not.
-
There is also some refactoring which can be reflected by the code base itself.