Platinum Partner

Finding Fibonacci With Mathematical Formula in C

Finding Fibonacci sequence can be done by a simple logic, but here's a math formula. it can solve the case too. 


The formula :  Fn = (x1^n – x2^n) / root(5)  dengan pembulatan kebawah
    where X1 and X2 are the roots of    x^2  - x - 1=0  equation      
   to find  X1 and X2 , we can use the following formula
   
   So that  X1,X2  =>   
int fibonaci(int n){
    
    int i;float tmp;
    
    //x^2 - x - 1 =0
    float x1 = ( 1 + sqrt(5) ) / 2;
    float x2 = (1 - sqrt(5) ) / 2;  
    
    for(i=0;i
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}