Last active
December 10, 2016 19:00
-
-
Save wen-dell/4c5aac8dabfa017dcaa1342c85e88921 to your computer and use it in GitHub Desktop.
Verificar se é primo
This file contains hidden or 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 class Primo { | |
public static boolean isPrimo(int numero){ | |
if(numero == 0 || numero == 1){ | |
return false; | |
} | |
for(int i = 2; i < numero/2; i++){ | |
if(numero % i == 0){ | |
return false; | |
} | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment