**Fibonacci series logic c:** This is the Fibonacci Series in c program evaluation by entering the values. This explains how the values are taken in loop and how Fibonacci series in printed.

Let the number entered by the user is 5, i.e., n=5 and a=0, b=i=1

Print a ,i,e, “Fibonacci series: 0”

**while (i<n) ** /* while loop is executed till i is less than n */

**while (i<5)** /* while loop is executed till i is less than 5 */

**1st Iteration: while (1 < 5) /* condition is true** */

print b ,i.e., “Fibonacci series: 0, 1”

sum = a + b = 0 + 1 = 1

a = b ,i.e., a=1

b = sum ,i.e., b=1

while loop will continue

i is incremented to 2 ,i.e., i=2

**2nd Iteration: while (2 < 5) **** /* condition is true** */

print b ,i.e., “Fibonacci series: 0, 1, 1”

sum = a + b = 1 + 1 = 2

a = b ,i.e., a=1

b = sum ,i.e., b=2

while loop will continue

i is incremented to 3 ,i.e., i=3

**3rd Iteration: while (3 < 5) **** /* condition is true** */

print b ,i.e., “Fibonacci series: 0, 1, 1, 2”

sum = a + b = 1 + 2 = 3

a = b ,i.e., a=2

b = sum ,i.e., b=3

while loop will continue

i is incremented to 4 ,i.e., i=4

**4th Iteration: while (4 < 5) **** /* condition is true** */

print b ,i.e., “Fibonacci series: 0, 1, 1, 2, 3”

sum = a + b = 2 + 3 = 5

a = b ,i.e., a=3

b = sum ,i.e., b=5

while loop will continue

i is incremented to 5 ,i.e., i=5

**5th Iteration: while (5 < 5) **** /* condition is false** */

while loop will break and displays the final output

In this way Fibonacci series c program will work and print series