The Judge tells that out is wrong but I can get the output on my PC
Can anyone please help me with it?(Written In Java)
My Solution:
import java.util.;
import java.io.;
class Main
{
public static void main (String[]args) throws IOException
{
try
{
int test, count = 0;
Scanner read = new Scanner (System.in);
test = read.nextInt ();
int size = test * 2;
int a[] = new int[size];
for (int i = 0; i < size; i = i + 2)
{
a[i] = read.nextInt ();
a[i + 1] = read.nextInt ();
}
for (int cl = 0; cl < size; cl = cl + 2)
{
int low = a[cl];
if (low == 1)
{
low++;
}
int high = a[cl + 1];
while (low <= high)
{
boolean flag = false;
for (int i = 2; i <= low / 2; ++i)
{
if (low % i == 0)
{
flag = true;
break;
}
}
if (!flag)
System.out.println (low);
++low;
}
System.out.println ();
}
}
catch (Exception e)
{
return;
}
}
}