- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprime.java
More file actions
Latest commit
26 lines (23 loc) · 475 Bytes
/
Copy pathprime.java
File metadata and controls
26 lines (23 loc) · 475 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
packagejavatest;
importjava.util.Scanner;
publicclassprime {
publicstaticvoidmain(String[] args) {
ints,e;
System.out.println("enter the start range");
Scannerabc=newScanner(System.in);
s=abc.nextInt();
System.out.println("enetr the end range");
e=abc.nextInt();
for(inti=s;i<e;i++) {
intc=0;
for(intj=2;j*j<i;j++) {
if(i%j==0) {
c=c+1;
}
}
if(c==0) {
System.out.println(i);
}
}
}
}