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
41 lines (36 loc) · 1017 Bytes
/
PrimeNumber.java
File metadata and controls
41 lines (36 loc) · 1017 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
39
40
41
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//Rinaldy Achmad Fauzy
//1301154357
//IF 39-07
package primenumber;
import java.util.Scanner;
/**
*
* @author Rinaldy A
*/
public class PrimeNumber {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int bilangan1,x;
int z=0;
Scanner cin=new Scanner (System.in);
System.out.println("Input Bilangan: ");
bilangan1=cin.nextInt();
for (x=1; x<=bilangan1; x++){
if (bilangan1%x==0){
z=z+1;
}
}
if (z==2){
System.out.println("Bilangan ini adalah Prima");}
else{
System.out.println("Bilangan ini bukan bilangan Prima");}
}
}