Created
January 28, 2021 13:16
-
-
Save lifeparticle/1626a6ab1ff831531cb3a5147e205e49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isPrime(int number) { | |
int factorCount = 0; | |
for (int i = 1; i <= number; i++) { | |
if (number % i == 0) | |
factorCount++; | |
} | |
return factorCount == 2 ? true : false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why not just
on the 7 line?