Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- System.out.print("n=");
- int n = scanner.nextInt();
- boolean isPrime = false;
- for (int i = 2; i <= n / 2; ++i) {
- if (n % i == 0) {
- isPrime = true;
- break;
- }
- }
- if (!isPrime)
- System.out.println("Yes");
- else
- System.out.println("No");
- }
- }
Add Comment
Please, Sign In to add comment