my prime visit code is not submitting always giving test case 2 error dont know how to solve this test case
my code
:
package practice;
import java.util.*;
public class PrimeVisit {
main() {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
while(n!=0){
int low = sc.nextInt();
int high=sc.nextInt();
int count=0;
while (low < high)
{if(low==1 || low==0)
count=-1;
boolean flag = false;
for(int i = 2; i <= low/2; ++i) {
if(low % i == 0) {
flag = true;
break;
}
}
if (!flag)
count++;
++low;
}
System.out.println(count);
n--;
}
}
}