public class panduansushu {
public static void main(String args[]) {
int x, y, j;
Scanner i = new Scanner(System.in);
System.out.print("请输入一个数:");
y = i.nextInt();
j = (int) y / 2;
for (x = 2; x <= j; x++) {
if (y % x == 0) {
System.out.println("此数不为素数");
break;
}
}
if (x > j) {
System.out.println("此数为素数");
}
}
}