C Program Fibonacci Series by Recursion

Output

How many terms of Fibonacci series are required? 7

Using Recursion, the Fibonacci series terms are:

0, 1, 1, 2, 3, 5, 8,

——————————–

Process exited after 25.97 seconds with return value 0

Press any key to continue . . .

#include<stdio.h> /* function prototype*/ int fibo(int); int main() { int n, i = 0, k; printf("How many terms of Fibonacci series are required? "); scanf("%d", &n); printf("Using Recursion, the Fibonacci series terms are:\n"); for (k = 1; k <= n; k++) { printf("%d, ", fibo(i)); i++; } return 0; } /* recursive function to find nth fib term */ int fibo(int n) { if (n == 0 || n == 1) return n; else return (fibo(n-1) + fibo(n-2)); }

## More Recursion Example Programs in C Language

## C Program Fibonacci Series by Recursion

- Factorial by Recursion
- Power by Recursion
- Fibonacci Number series by Recursion
- Reverse a Number by Recursion
- Sum of Digits by Recursion
- GCD by Recursion and More Programs

### Program Factorial by Loop and Recursion Versions