Demo entry 6324471

Fibonacci Recursive

   

Submitted by ANON on Nov 18, 2016 at 16:30
Language: C. Code size: 197 Bytes.

#include<stdio.h>

int fib_acc(int N, int f1, int f2){

    if (N>=1)
       return fib_acc(N-1,f2,f2+f1);
    else 
       return f1; 
}

int fib (int N){
   return fib_acc(N,1,1);
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).