Programming Code Center(PCC)
[JAVA]

(PCC)::[How-to-write-Java-Program-to-Display-Prime-Numbers-Between-Two-Intervals]::[java]

File Name : PrimeNew.java

//Example : Display Prime Numbers Between two Intervals
public class PrimeNew {

    public static void main(String[] args) {

        int low = 20, high = 50;

        while (low < high) {
            boolean flag = false;

            for(int i = 2; i <= low/2; ++i) {
                // condition for nonprime number
                if(low % i == 0) {
                    flag = true;
                    break;
                }
            }

            if (!flag)
                System.out.print(low + " ");

            ++low;
        }
    }
}

Output :

PrimeNew.jpg