9/21/2014

Source Code Java Netbeans Mencari Bilangan Amisabel

Source Code Java Netbeans Mencari Bilangan Amisabel - Mencari Bilangan Amisabel menggunakan kompiler Java Netbeans, berikut ini Source Code Program yang bisa langsung diterapkan ke dalam kompiler Java Netbeans.

public class Amisabel_Tian_Chan {

    public static void main(String[] args) {
        for(int i=1;i<=5000;i++){
            if(Amisabel(i)){
                System.out.print(i+" = ");
                for(int x=1;x<=i;x++){
                    if (i % x == 0) {
                        System.out.print(x);
                        if((i==1)||(i/x==2)) break;
                        if(x!=i) {
                            System.out.print(" + ");
                        }
                    }
                }
                System.out.println("");
            }
        }
    }

    public static boolean Amisabel(int x){
        int tot = 0;
        if(x==1) return true;
        else {
            for (int i=1;i<x;i++) if (x % i == 0) tot += i;
            if (tot == x) return true;
            else return false;
        }
    }
}
Sekian program tentang Source Code Java Netbeans Mencari Bilangan Amisabel, semoga bermanfaat.

Tidak ada komentar:

Posting Komentar

Silahkan komentar jika ada yang ingin Anda tanyakan mengenai artikel Materi IT.

Jangan lupa melakukan Checklist "Notify me" untuk mendapatkan email balasan dari Admin.

Septian Maulana - 08997206535 (WhatsApp).

Computer Science:
Group CS - https://bit.ly/CSUtama
Group CS 2 - https://bit.ly/cs2group
Group CS 3 - https://bit.ly/cs3group
Group CS 4 - https://bit.ly/cs4group
Group CS 5 - https://bit.ly/cs5group
Group CS 6 - https://bit.ly/cs6group
Group CS Telegram - https://bit.ly/cstelgroup