2
Answers

Fibonacci sequence

Ken H

Ken H

11y
1k
1
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)