public static void main(String[] args) {
for (int i=0; i<100; i++) {
isPrime(i);
}
}
private static boolean isPrime(int n) {
double k = Math.sqrt(n);
int i = 2;
while (i <=k ) {
if (n % i++ == 0) {
System.out.println(n + " is not a prime");
return false;
}
}
System.out.println(n + " is a prime");
return true;
}