Skip to content

Instantly share code, notes, and snippets.

@ryush00
Created July 18, 2015 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryush00/4af5c1c004956e3dda25 to your computer and use it in GitHub Desktop.
Save ryush00/4af5c1c004956e3dda25 to your computer and use it in GitHub Desktop.
소수 구하기
class Tester {
public static void main(String[] args) {
for (int i = 1; i <= 100; i++) {
if (isTest(i))
System.out.println(i);
}
}
public static boolean isTest(int num) {
if (num == 1)
return false;
for (int i = 2; i < num; i++) {
if (num % i == 0)
return false;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment