题解 | #判断质数#
判断质数
https://www.nowcoder.com/practice/4d2a100c2e544f56ac1ad17e9ffa107d
import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
boolean x = false;
int count =0; //表示整除的次数
//质数是指在大于1的自然数中,除了1和它本身以外不再有其他因数的自然数。
for(int i=1 ; i<=a;i++){
if(a%i==0){
count++;
}
}
if(count ==2){
x = true;
System.out.print(x);
}else if(count >2){
System.out.print(x);
}
}
}



