What is Fibonacci Series?
The Fibonacci series is the sequence where each number is the sum of the previous two numbers of the sequence. The first two numbers of the Fibonacci series are 0 and 1 and are used to generate the Fibonacci series.
In mathematical terms, the number at the nth position can be represented by:
Fn = Fn-1 + Fn-2
with seed values, F0 = 0 and F1 = 1.
For example, Fibonacci series upto 10 terms is: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34
The Fibonacci programs in C that print the first n terms of the series can be coded using two methods specified below:
- Fibonacci series using recursion
- Fibonacci series using loops
Fibonacci Series Program in C
In this article, we will discuss the Fibonacci series and the programs to print the Fibonacci series in C using recursion or loops.