Skip to content

Instantly share code, notes, and snippets.

@ssd863419
Created May 1, 2014 06:02
Show Gist options
  • Save ssd863419/5e1f7cebf8993818b236 to your computer and use it in GitHub Desktop.
Save ssd863419/5e1f7cebf8993818b236 to your computer and use it in GitHub Desktop.
isPrimeNum
public class Test {
public static boolean isPrimeNum(int inPut){
for (int i = 2; i < inPut/2; i++) {
if ( inPut % i == 0 ) {
return false;
}
}
return true;
}
public static void main(String[] args) {
for (int i = 100; i < 200; i++) {
if (isPrimeNum(i)) {
System.out.print(i + ",");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment