Fibonacci Series in C

Fibonacci Series in C

Here, you will get the program code to create Fibonacci Series in C programming language. We will be make this program by using two different methods ( Fibonacci series using recursion, and Fibonacci Series using for loop).

Fibonacci Series in C

What is Fibonacci Series?

The Fibonacci sequence is the series of the sum of previous two digits in a sequence. The first two numbers must be 0 and 1 from starting. The example Fibonacci series is 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …

The Fibonacci sequence formula:

F(n) = F(n-1) + F(n-2)

where, 

F(0)=0

F(1)=1

F(n) is nth Fibonacci number.

 

Fibonacci series in C by using two ways

Method 1 (Recursion): Use a function that calls itself to calculate Fibonacci numbers. Input the term count and print the series.

Method 2 (For Loop): Initialize first two terms, then use a loop to calculate and print Fibonacci series by summing previous two terms in each step.

 

Fibonacci Series in c using recursion  

Output

fibonacci series

 

 

Fibonacci Series in c using for loop

Output
fibonacci series

 

 

 

Check out our other C programming Examples

 

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top