5.Write a program in c to display the Fibonacci series up to a given number using a while loop.
Overview
The Fibonacci series is a sequence of integers that starts with 0 and then 1 in this sequence the first two terms are determined 0 , 1 and by adding the previous two terms we get the next terms.
That is the series follows a pattern where each number is equal to the sum of the previous two numbers.
Mathematically this can be written as š¹(š) = š¹(šā1)+š¹(šā2)F(n)=F(nā1)+F(nā2) where F is the Fibonacci function with initial values š¹(0)=0F(0)=0 and š¹(1)=1F(1)=1. welcome to my course.
Sample example of Series:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34
Fibonacci Series
Follow the sequence below
0, 1, 1, 2, 3, 5, 8, 13, 21, 34
I saw this above and seen a pattern in it.
In this term, the first term is 0 and the second term is 1, and all the remaining terms we have are the sum of the previous two terms.
For example, the eighth term is 13, which continues with 5 and 8, whose sum is 13, and therefore the eighth number is calculated as 13.
i.e.
0
1
0 + 1 = 1
1 + 1 = 2
2 + 1 = 3
3 + 2 = 5
5 + 3 = 8
...
Note : In some sources the Fibonacci sequence also starts with 1, but in most places the Fibonacci sequence starts only with 0.
Real Life Applications
In Flower Petals
The number of petals in a flower corresponds to the continuous Fibonacci sequence. Famous examples include the three petalled lily, the five petalled lily, the 21 petalled chicory, the 34-petalled chamomile, etc. The ideal packing arrangement is selected using the Darwin process, leads to the formation of plank petals. Each petal is spaced 0.618034 per revolution (360 degrees in a circle) to provide the best exposure to sunlight and other elements.
In Computer Science
Fibonacci sequence has a popular application and uses in computer science algorithms for performing various tasks such as sorting and searching.
In Biology
The Fibonacci sequence appears in biological environments such as tree branches, the arrangement of leaves on a stem, the flowering of an artichoke and the spiral arrangement of sunflower seeds.
In Mathematics
The Fibonacci sequence is used in number theory, algebra and geometry. It is used for analyzing financial markets and computer algorithms.