- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrimeNumber.java
More file actions
Latest commit
38 lines (28 loc) · 639 Bytes
/
Copy pathPrimeNumber.java
File metadata and controls
38 lines (28 loc) · 639 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
27
28
29
30
31
32
33
34
35
36
37
38
importjava.util.Scanner;
classPrimeNumber
{
publicstaticvoidmain(String[] args)
{
Scanners = newScanner(System.in);
System.out.println("---- Program will Print PRIME NUMBER of given range");
System.out.println("Enter Start number :" );
intstart = s.nextInt();
System.out.println("Enter End number :" );
intend = s.nextInt();
for (inti=start; start<=end ;start++ )
{
intk = 2;
for (intj=k;k<=start ;k++ )
{
if (start%k==0)
{
break;
}
}
if (k == start)
{
System.out.println("Prime Number is : "+num);
}
}
}
}