Ad (728x90)

Wednesday, November 30, 2016

Filled Under:

Algoritma Rekursif

  • Function pangkat(a : integer; n : integer):integer;

         if n = 0 then
         begin
             pangkat := (1);
         end
         else
         begin
             pangkat := (a*pangkat(a, n-1));
         end;

    endfuction
  • Algoritma Menentukan Deret Bilangan Fibonacci

    Deklarasi:

    i, n, fibonacci(i): integer

    Deskripsi:

    input(n)
    if i=0 atau i=1 then
    cetak “fibonacci(i)=i”
    else
    while i>1 dan i=n do
    fibonacci(i)=fibonacci(i-1)+fibonacci(i-2)
    cetak fibonacci(i)
    i=i+1
    end
  • Function gcd(m, n : integer) : integer;
    var r : integer;
    begin
        r := m mod n;

        while (r <> 0) do begin
            m := n;
            n := r;
            r := m mod n;
        end;

        gcd := n;
    end;
          Fibonacci := Fibonacci(n - 1) + Fibonacci(n - 2);

Adj

Author & Editor

Silahkan Copy Paste Tapi Cantumin Link Sumber Ya kk (^3^) Ok | Kalo Gak Tak Tabok (---)p

0 komentar:

Post a Comment

 

We are featured contributor on entrepreneurship for many trusted business sites:

  • Copyright © Tutorial Makassar™ is a registered trademark.
    Blogger Templates Designed by Templateism. Hosted on Blogger Platform.