1public class Prime {
2
3 public static void main(String[] args) {
4
5 int low = 20, high = 50;
6
7 while (low < high) {
8 boolean flag = false;
9
10 for(int i = 2; i <= low/2; ++i) {
11 // condition for nonprime number
12 if(low % i == 0) {
13 flag = true;
14 break;
15 }
16 }
17
18 if (!flag && low != 0 && low != 1)
19 System.out.print(low + " ");
20
21 ++low;
22 }
23 }
24}