Created
September 22, 2016 15:09
-
-
Save devetude/f62de976bf7214c3da24fbf8f5438968 to your computer and use it in GitHub Desktop.
소수판별 1 (Check Prime Number 1)
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
import java.util.Scanner; | |
/** | |
* 소수판별 1 (Check Prime Number 1) | |
* | |
* @author devetue | |
*/ | |
public class Main { | |
public static void main(String args[]) { | |
Scanner sc = new Scanner(System.in); | |
int N = sc.nextInt(); | |
sc.close(); | |
int res = -1; | |
for (int i = 2; i < N; i++) { | |
if (N % i == 0) { | |
res = i; | |
break; | |
} | |
} | |
if (res != -1 || N == 1) { | |
System.out.println(N + " isn't prime number"); | |
} | |
else { | |
System.out.println(N + " is prime number "); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment