# Write a program to generate the Fibonacci series using recursive method?

As a simple rule of recursion, any function can be computed using a recursive routine if :

1. The function can be expressed in its own form.
2. There exists a termination step, the point at which f(x) is known for a particular ‘x’.

Therefore to write a recursive program to find the nth term of the fibonacci series, we have to express the fibonacci sequence in a recursive form using the above 2 rules :

1. fib(n) = fib(n-1) + fib(n-2) (recursive defination of fibonacci series).
2. if n=0 or n=1, return n (termination step).

Using these 2 rules, the recursive program for finding the nth term of the fibonacci series can be coded very easily as shown.

In mathematics, the Fibonacci numbers are the numbers in the following sequence:

0,1,12,3,5,8,13,21,34,55,89,144

#include”stdio.h”
#include”conio.h”
int fabo(int);
void main()
{
int result=0,a=1,b=1,c;
printf(“enter upto which you want to generate the series”);
scanf(“%d”,&c;);
result=fabo(c);
printf(“%dn%dn”,a,b);
printf(“the fabonnaci series is %dn”,result);
getch();
}
int fabo(int n)
{
if (n==1);
return 1;
else if(n==2);
return 1;
else
return fabo(n-1)+fabo(n-2);
}