Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

SPOJ Prime1

import java.util.*;
import java.lang.*;

class Main
{
    public static void main (String[] args)
    {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int i = 0;
        long n1=0;
        long n2=0;
        while(i<=n){

            n1  = sc.nextLong();
            n2  = sc.nextLong();
            if(n1==1)
            {
                n1++;
            }
            if((n1-n2)<=100000){

            for(long j=n1;j<=n2;j++){

                int count = 0;

                for(long k=2;k<=j/2;k++){
                    if(j%k==0){
                        count = 1;
                    }
                }
                if(count==0){
                    System.out.println(j);
                }

            }
            }
        }


    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: Betrag absolute abs java 
Java :: make new file in intellij for java 
Java :: change button background drawable in code Close 
Java :: PlatformException (PlatformException(unknown, java.lang.Exception: Client is offline, {code: unknown, message: java.lang.Exception: Client is offline}, null)) 
Java :: java arraylist max length 
Java :: unique numbers in array java 
Java :: cgange background from button click java fx 
Java :: java equals on recursive apache commons 
Java :: kotlin to java converter online 
Java :: how to make easy animations in canva 
Java :: spring boot thymeleaf bindingresult 
Java :: java loop array 
Java :: Java Creating HashMap from Other Maps 
Java :: java reverse a word 
Java :: javax.servlet.ServletException: javax.servlet.jsp.JspException: Missing message for key 
Java :: Java Protected Access Modifier package two 
Java :: Change the java version of a eclips maven project 
Java :: number of zeros in a binary array 
Java :: java take inpt into arraylist 
Java :: A method that returns a stream of JUnit Arguments 
Java :: factorial java recursion 
Java :: add elements to arraylist of arraylist in java 
Java :: java oop design patterns 
Java :: zebra zpl print java 
Java :: collapsingtoolbarlayout collapse listener 
Java :: two array structures in java 
Java :: is type java 
Java :: how to implement count steps in android 
Java :: android set socket timeout 
Java :: how to create space between element in vbox in javafx 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =