代码语言:javascript复制
import java.util.Scanner;
import java.lang.Math;
public class studying {
private static boolean isprime(int target){
if(target<2)
return false;
for(int i=2;i<=Math.sqrt(target);i )
if(target%i==0)
return false;
return true;
}
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int target=input.nextInt();
if(isprime(target))
System.out.println("The number is a prime number!");
else
System.out.println("The number is not a prime number!");
}
}