├── .gitignore ├── PrimeBetweenRange.java └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | replay_pid* 25 | -------------------------------------------------------------------------------- /PrimeBetweenRange.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class PrimeBetweenRange 3 | { 4 | public static void main(String[] args) { 5 | Scanner sc=new Scanner(System.in); 6 | int start=sc.nextInt(); 7 | int end=sc.nextInt(); 8 | int count=0; 9 | for(int i=start;i<=end;i++){ 10 | count=0; 11 | for(int j=1;j<=i;j++){ 12 | if(i%j==0){ 13 | count++; 14 | } 15 | 16 | } 17 | if(count==2){ 18 | System.out.print(i+" "); 19 | 20 | } 21 | 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Prime-number-within-a-given-range-Java 2 | Given an integer input the objective is to check whether or not there are any Prime Numbers in the given interval or range. Therefore, we write a code to Find the Prime Numbers in a Given Interval in Java Language. 3 | --------------------------------------------------------------------------------