Untitled

 avatar
unknown
java
9 months ago
505 B
2
Indexable
import java.util.Scanner;

public class P1 {
	public static boolean Sol(int n) {
		for (int i = 2; i <= Math.sqrt(n); i++) {
			if (n % i == 0)
				return false;
		}

		return n > 1;
	}

//	6 = 1, 2, 3, 6
// 8 = 1,2 ,4,8
	// 10 =

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

//		System.out.println(Sol(n));
//		Sol(n);
		if (Sol(n)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}
Editor is loading...
Leave a Comment