My issue
I am practicing this problem and there is no contest that is currently running on
so how is it stopping me from saying that my time is over for this contest
It is just a practice problem
My code
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void SieveOfEratosthenes(int m,int n){
boolean[] prime = new boolean[n+1];
Arrays.fill(prime,true);
prime[1] = false;
for(int i = 2 ; i*i<=n;i++){
if(prime[i]){
for(int j = i*i ;j<=n;j+=i)
prime[j] = false;
}
}
for(int i = m;i<=n;i++){
if(prime[i])
System.out.println(i);
}
}
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t-->0){
int m = s.nextInt();
int n = s.nextInt();
SieveOfEratosthenes(m,n);
}
}
}
Problem Link: PRIME1 Problem - CodeChef