class Main {
public static void main(String[] args) {
//tells whether a given no. is prime or not ?
boolean flag = isPrime(4);
System.out.println("4 is prime ?" +flag);
flag = isPrime(432);
System.out.println("43 is prime ?" + flag);
}
static boolean isPrime(int N) {
boolean check = true;
if (N == 1 || N == 0) {
check = false;
}
else {
//run till the square root of the number
for (int i =2; i<= Math.sqrt(N); i++) {
if(N%i == 0) {
check = false;
break;
}
}
}
return check;
}
}