jump to navigation

Menghitung Fibonasci December 1, 2011

Posted by kelompok24itbseamolecb5 in Algoritma dan Struktur Data.
trackback

Algoritma :

Judul : Algoritma Menghitung Fabonasi

Kamus :

int ← max, bil1 ← 0, bil2←2

Deklarasi :

Input (masukkan nilai atau angka :  )

for (int i←0; i< max ; i ++
print( bil1+);
bil1=bil1+bil2;
bil2=bil1-bil2;

Source Code :

import java.util.*;
public class Fabonaci {
public static void main (String [] args){
int max,bil1=0,bil2=1;

Scanner ambil=new Scanner (System.in);

System.out.print(“Masukkan angka  : “);
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”);

}

}

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: