Deret Fibonancy : 0,1,1,2,3,5,8,13,.........
Secara notasi pemrograman dapat ditulis sebagai :
Fibo (1) = 0 & Fibo (2) = 1 ....................................... (1)
Fibo (N) = Fibo (N-1) + Fibo (N-2) ................................. (2)
Contoh :
Deret Fibonancy
A[1] = 1;
A[2] = 2;
For (i=3; i<=10; i++)
{
A[i] = A[i-1] + A[i-2];
}
0 comments:
Post a Comment