#include<stdio.h>//header file
#include<conio.h>//header file
int n,a=0,b=1,c=0;
void fib();
void main() //starting of the main() function
{
clrscr();
printf("program that displays the fabbonacy series using recursion");
printf("\n\n\n\t\t------------INPUT-------------");
printf("\n\nenter the range for the fabbonacy series");
scanf("%d",&n);//taking input from the user
printf("\n\n\n\t\t------------OUTPUT------------");
if(n==0)
{
printf("\n\nrange is not appropriate");
getch();
exit(0);
}
if(n==1)
{
printf("\n\nthe fabonaccy series is= 0");
getch();
exit(0);
}
printf("\n\nthe fabonaccy series is:%d %d",a,b);//printing output
fib();
getch();
}
void fib()
{
int p;
if(c<n-2)
{
p=a+b;
printf(" %d",p);//printing output
a=b;
b=p;
c++;
fib();
}
}