Menghitung Febonanci

Algorithma :
Judul : Algoritma menampilkan bilangan Ferbonanci
Spesifikasi : {menampilkan deret bilangan faktorial. Jumlah deret diinputkan melalui keyboard }
Deklarasi (kamus) :
Max,bil1,bil2 : Integer
Deskripsi :

Bil1 » 0

Bil2 » 1

Read(“Masukkan angka maksimal : “, max)

Write(max,” Deret Fibonaci :”)

for i=0 to max then

Write(bil1,” “)

bil1=bil1+bil2

bil2=bil1-bil2

endfor

Listing Program :

 args){
 int max,bil1=0,bil2=1;
 Scanner ambil=new Scanner (System.in);
 System.out.print("Masukkan angka max : ");
 max=ambil.nextInt();
 System.out.print(max+" Deret Fibonaci :");
 for (int i=0;i<max;i++ ){
 System.out.print(bil1+" ");
 bil1=bil1+bil2;
 bil2=bil1-bil2;
 }
 System.out.println("n");
 }
 }

About Ade Akbar

Hidup, Berarti dan Mati

Posted on Desember 2, 2011, in Tugas. Bookmark the permalink. Tinggalkan komentar.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: