fibonacci series using recursion

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

int main()

{
  int n, i = 0, c;


  printf(" Enter the number of fibonacci : \n");

  scanf("%d", &n);

  printf("The Fibonacci series terms are as follows:\n ");


  for (c = 1; c <= n; c++)

  {
    printf("%d\n", fibo(i));
    i++;
  }

  return 0;

}

int fibo(int n)

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

OUTPUT :-






For Other Programs Visit The WebSite:-   https://www.techapurba.com/

Follow Me On Social Media :-

For tech related videos visit my other website :- https://apurbatechinfo.blogspot.com/

Post a Comment

0 Comments