Ken H

Ken H

  • NA
  • 646
  • 360.2k

Fibonacci sequence

Sep 21 2013 7:56 PM
hi,
   Why "Fibonacci (day-1)" and "Fibonacci (day-2)" are not the same recursive procedure?
Code is as follows:

#include<stdio.h>
int Fibonacci(int day)
{
 if(day==1||day==2) 
 return 1;
 else 
return Fibonacci(day-1)+Fibonacci(day-2);
}

void main()
{
  printf("Fibonacci sequence:%d\n",Fibonacci(7));
}


thank.

Answers (2)