Deret Bilangan Prima menggunalan platform Java Netbeans, berikut ini Source Code Program yang bisa anda terapkan di platform anda.
package bilangan.prima;
import javax.swing.JOptionPane;
public class BilanganPrima {
public static void main(String[] args) {
int n, a = 2, b, jum = 0;
boolean temp;
String angka = JOptionPane.showInputDialog("Masukan nilai n : ");
n = Integer.parseInt(angka);
System.out.println("Nilai n = " + n);
while (jum < n) {
temp = true;
for (b = 2; b < a; b++) {
if (a % b == 0) {
temp = false;
break;
}
}
if (temp == true) {
System.out.print(a + " ");
jum++;
}
a++;
}
}
}
Berikut output dari Source Code Program Deret Bilangan Prima :
Monday, January 1, 2018
Source Code Java Netbeans Program Menampilkan Deret Bilangan Prima
Penulis Unknown
Diterbitkan January 01, 2018
Artikel Terkait
Subscribe to:
Post Comments (Atom)
EmoticonEmoticon