recursive fibonacci sequence code example
Example: fibonacci sequence single recursive call
int fibonacci(int i, int sum1, int sum2)
{
if(i == 1) {
return sum2;
}
return fibonacci(i - 1, sum2, sum1 + sum2);
}
int fibonacci(int i, int sum1, int sum2)
{
if(i == 1) {
return sum2;
}
return fibonacci(i - 1, sum2, sum1 + sum2);
}