Fibonacci series using recursion: To print the Fibonacci series this is implemented using recursion in c.

Recursion in c :
It is a process where function calls itself directly or indirectly.

What is Fibonacci?
Fibonacci series is a collection or set of the numbers starting with zero or one, followed by the sum of two preceding numbers.
Consider Fibonacci series till N which is implemented as 0,1,(0+1),(0+2)…. N.

Example :
Write a Fibonacci series up to 8 numbers.
we calculated this series as first two number as 0 and 1 , 0+1 => 1, 1+2=>3 ,3+2=>5,5+3=>8,8+5=>13

Fibonacci algorithm

  1. Write a recursive function to find the Fibonacci series. fib(int)
  2. Write the main
  3. Declare variable. N
  4. Take a number from user. N
  5. Pass Number and call recursive function. fib(n)
  6. Find Fibonacci series in function
  7. Print Fibonacci series.

C program for Fibonacci series using recursion


int fibonacci(int n)

int main()
int n,i=0;
printf("Input the number of terms for Fibonacci Series:");
printf("\nFibonnaci Series is as follows\n");
printf("%d ",fibonacci(i));

return 0;

Output :

Fibonacci series using recursion

Write A Comment