Created
July 18, 2015 15:55
-
-
Save ryush00/4af5c1c004956e3dda25 to your computer and use it in GitHub Desktop.
소수 구하기
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
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