my code is run another Ide and in this online ide have not work properly ,the out show Testcase wrong answer .
How to submit code perfectly
public class isPrime{
public static void main(String[] args) {
int start=1;
int end=10000;
for(int i=start;i<=end;i++){
if(isPrime1(i)){
System.out.println(i +" is prime");
}
}
}
public static boolean isPrime1(int n){
if(n<=1){
return false;
}
else{
for(int i=2;i<=Math.sqrt(n);i++){
if(n%i==0){
return false;
}
}
}
return true;
}
}
your logic seems fine…but you have to take input the no. of test cases from the user and then you have to take start and end also from the user…
also check how you have to print the output…you do not have to print " is prime"