hi guys, i wanna ask why i always get error when compiling prime1. I try at my netbeans but its works.
this is my codes
import java.util.*;
import java.lang.*;
import java.lang.Math;
public class Main {
public static void main(String[] args) throws java.lang.Exception {
Scanner sc = new Scanner(System.in);
int testCases = sc.nextInt();
int ranges[][] = new int[testCases][2];
for (int i = 0; i < testCases; i++) {
ranges[i][0] = sc.nextInt();
ranges[i][1] = sc.nextInt();
}
for (int i = 0; i < testCases; i++) {
int m = ranges[i][0];
int n = ranges[i][1];
double sqrt = 0.0;
int j = 0;
for (int k = m; k <= n; k++) {
if (k == 1) {
continue;
}
if (k == 2) {
System.out.println(k);
continue;
}
if (k % 2 != 0) {
sqrt = Math.sqrt(k);
for (j = 3; j <= sqrt; j = j + 2) {
if (k % j == 0) {
break;
}
}
if (j > sqrt) {
System.out.println(k);
}
}
}
if (i < testCases - 1) {
System.out.println();
}
}
sc.close();
}
}