cpp icon indicating copy to clipboard operation
cpp copied to clipboard

Refactor Prime_number_check

Open CiganOliviu opened this issue 4 years ago • 0 comments

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.

CiganOliviu avatar Nov 17 '20 11:11 CiganOliviu