Java program to print prime numbers between two numbers
public class Main {
public static void main(String[] args) {
// find the prime numbers between 11 to 44
int No1 = 11;
int No2 = 44;
while(No1 < No2) {
boolean flag = false;
for(int i=2; i<No1/2; i++) {
if(No1 % i == 0) {
flag = true;
break;
}
}
if(!flag) {
System.out.println(No1 + " ");
}
No1++;
}
}
}