Friday, March 14, 2014

2.6 Generation Of The Fibonacci Sequence

Algoritma

     1. Analisisnya
                Membuat program deret fibonacci
     2. Identifikasi
                Input   : a, b, c, d
                Output : X
     3. Algoritmanya
               Deklarasi
                      n         : integer
                       i         : integer
                      a[1..50]: integer
               Deskripsi
                     Read n
                     For i <- 0 to n do
                      If (i < 2) then
                      a[ i ] <- i
                      Else
                      a[ i ] <- a[ i - 2 ] + a[ i - 1 ]
                      end if
                      end for
                      For i <- 0 to n do
                      Write a[ i ]
                      end for
                      end


Flowchart




C++



0 comments:

Post a Comment

Template by:

Free Blog Templates