How can i terminate while loop when user press 'q' so program should exit?
It is Simple Java Program and i am not using swing etc.
while (flag) {
                int x = ran.nextInt(MaxValue - MinValue + 1);
                System.out.print(x);
                System.out.print(" enclosed by {");
                for (int i = 0; i < arr.length; i++) {
                    System.out.println(arr[i][0]);
                    if ((x >= arr[i][0]) && (x <= arr[i][1])) {
                        System.out.print("(" + arr[i][0] + "," + arr[i][1] + ")");
                    }
                }
                System.out.print("}\n");
                count++;
            }