Search This Blog

Translate

c program to print fibonacci series using recursion

write a c program using recursive function to print Fibonacci series


#include
#include
void figo(int);
int a=0,b=1,c;
void main()
{
  int n;
  clrscr();
  printf("enter the number : ");
  scanf("%d",&n);
  printf("%d\n%d",a,b);
  figo(n) ;
  getch();
}

void figo(int n)
{

 if(n)
 { c=a+b;

 printf("\n %d",c);
   a=b;
   b=c;
   figo(n-1);
  }

 }






C Program example List

Google+ Badge