1public class Prime {
2 public static void main(String[] args) {
3
4 int num = 29;
5 boolean flag = false;
6 for(int i = 2; i <= num/2; ++i){
7 if(num % i == 0){
8 flag = true;
9 break;
10 }
11 }
12
13 if (!flag)
14 System.out.println(num + " is a prime number.");
15 else
16 System.out.println(num + " is not a prime number.");
17}}