输入一个数并判断它是否为质数
Scanner sc = new Scanner(System.in);
System.out.println(“please enter a numer”);
int a = sc.nextInt();
int count = 0;
for (int i = 2; i < a; i++) {
if (a % i == 0){
break;
}count++;
}
if (count == a - 2){
System.out.println("this is a zhishu ");
}else{
System.out.println("this is not a zhishu ");
}
}