Created
November 4, 2012 07:01
-
-
Save otarza/4010687 to your computer and use it in GitHub Desktop.
isPrime
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
private boolean IsPrime(int n) { | |
int f = n-1; | |
while(f!=1) { | |
int k=n%f; | |
f=f-1; | |
if(k==0) { | |
return false; | |
} | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment