About us

C Program for print Fibonacci series using recursion


C Program for print Fibonacci series using recursion 


c-program-print-Fibonacci-series-using-recursion

#include<stdio.h>
#include<conio.h>
long int fibo(int n);

void main()
{
 int num,i;
 clrscr();
 printf("Enter nth term for finding FIBONACCI Series till nth term\n");
 scanf("%d",&num);
 for(i=1;i<=num;i++)
  printf("%ld  ",fibo(i));
getche();
}

long int fibo(int n)
{
 if(n==1)
  return 0;
 if(n==2)
  return 1;
 else
  return(fibo(n-1)+fibo(n-2));
}



OUTPUT

c-program-print-Fibonacci-series-using-recursion

------------------------------------------------------------------------------------------------------------

You can also visit:-