import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
boolean isPrime = true;
for (int i = 2; i < n; i ++){
if (n % i == 0) {
isPrime = false;
break;
}
}
if (isPrime && n != 1)
System.out.println("yes");
else
System.out.println("no");
}
}
参考
标签:判断,Scanner,int,质数,是不是,System,file,isPrime From: https://www.cnblogs.com/fghjktgbijn/p/17366584.html