public class ForPrime {
public static void main(String[] args) {
int sum = 0;
for (int i = 2; i < 100; i++) {
if (isPrime((long) i))
{
System.out.println(" isPrime = " + i);
sum = sum +i;
}
}
System.out.println("The sum is:"+sum);
}
static boolean isPrime(long num) {
double intSqrtOfNum = Math.sqrt((double) num);
int i = 0;
for (i = 2; i < intSqrtOfNum; i++) {
if (num % i == 0)
break;
}
if (i > intSqrtOfNum)
return true;
return false;
}
}