Finding the fibonacci number of large number
<p>I wrote the following program for finding the modulus of large Fibonacci's number. This can solve large numbers but fails to compute in cases like <code>fibo_dynamic(509618737,460201239,229176339)</code> where <code>a = 509618737</code>, <code>b = 460201239</code> and <code>N = 229176339</code>. Please help me to make this work.</p>

<pre><code>long long  fibo_dynamic(long long  x,long long  y,long long  n, long long a[]){
    if(a[n]!=-1){
         return a[n];
    }else{
        if(n==0){
            a[n]=x;
            return x;
        }else if(n==1){
            a[n]=y;
            return y;
        }else {
            a[n]=fibo_dynamic(x,y,n-1,a)+fibo_dynamic(x,y,n-2,a);
            return a[n];
        }
    }
}
</code></pre>