forked from OOP-ADF/Task_1
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrimeNumber.java
More file actions
Latest commit
30 lines (28 loc) · 567 Bytes
/
Copy pathPrimeNumber.java
File metadata and controls
30 lines (28 loc) · 567 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
packagetask_1;
importjava.util.Scanner;
/**
*
* @author Andre Anugrah
*/
publicclassPrimeNumber
{
publicstaticvoidmain(String[] args)
{
//input
Scannerinp = newScanner (System.in);
System.out.println("Input angka : ");
intx = inp.nextInt();
//program
intcount = 0;
for (inti = 1; i <= x; i++){
if (x % i == 0){
count = count + 1;
}
}
//output
if (count == 2)
System.out.println("Bilangan prima");
else
System.out.println("Bukan prima");
}
}