forked from jvm-coder/Java_Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrimeNumber.java
More file actions
23 lines (23 loc) · 535 Bytes
/
PrimeNumber.java
File metadata and controls
23 lines (23 loc) · 535 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.util.*;
public class PrimeNumber{
public static void main(String arg[])
{
Scanner in = new Scanner(System.in);
System.out.println("Enter the Number:");
int num = in.nextInt();
int flag=0;
for(int i =2;i<num;i++)
{
if(num%i==0)
{
flag = 1;
}
}
if(flag==1){
System.out.println("NOT A PRIME NUMBER");
}
else{
System.out.println("PRIME NUMBER");
}
}
}