## C Program To Print Fibonacci Series using Recursion

Here’s a C Program To Print Fibonacci Series using Recursion Method. This Code To Generate Fibonacci Series in C Programming makes use of If – Else Block Structure. Recursion method seems a little difficult to understand. The Fibonacci Sequence can be printed using normal For Loops as well. The Recursive Function must have a terminating condition to prevent it from going into Infinite Loop.

#### What is Fibonacci Series?

A Fibonacci Series is a Sequence of Numbers in which the Next Number is found by Adding the Previous Two Consecutive Numbers. The First Two Digits are always 0 and 1.

A Fibonacci Series consists of **First Digit** as** 0** and **Second Digit** as **1**. The **Next Digit (Third Element)** is dependent upon the **Two Preceding Elements** (Digits). The Third Element so, the Sum of the Previous Two Digits. This addition of previous two digits continues till the Limit.

**Note:** The First Two Digits in a Fibonacci Series is always 0 and 1.

#### Example

**0 1 1 2 3 5 8**

**Also Read: C Program To Print Fibonacci Series using For Loop**

#### C Program To Print Fibonacci Series using Recursion Method

#include<stdio.h> int fibonacci(int x); int main() { int limit, res, count; printf("\nEnter the Number of Elements to be Printed:\t"); scanf("%d", &limit); for(count = 0; count < limit; count++) { printf(" %d ", fibonacci(count)); } printf("\n"); return 0; } int fibonacci(int x) { if(x == 0||x == 1) return x; else return (fibonacci(x - 1) + fibonacci(x - 2)); }

**Also Read: C Program To Find Sum of Digits of Number using Recursion**

#### Output

**Also Read: C Program To Find Factorial of Number using Recursion**

In case you get any Compilation Errors with this C Program To Print Fibonacci Series with Recursion method or if you have any doubt about it, mention it in the Comment Section.

Finally I got a working code for Fibonacci Series. Thanks

Fibonacci series in C is very easy actually. You just need to understand one single recursive statement. Glad that you liked it.

Which better for Fibonacci Series generation – Recursion or an Iterative loop?

I think Iterative Loop such as For, While or Do-While Loops are much better than Recursive approach because Recursion takes too much memory compared to For and While Loops.