Fibonacci Series start with a Zero and the next element is one then first we print 0 and 1. Now add two previous elements and print the next element as 0+1=1. repeat the process again and again until you get your answer.
0+1=1
1+1=2
1+2=3
2+3=5
3+5=8
5+8=13
8+13=21
13+21=34. . . .
Fibonacci Series in C++
#include <iostream>
using namespace std;
int main()
{
int a = 0, b = 1, i, n, c;
cout << "Enter The Number \n\n"; //Enter the number of terms
cin >> n;
cout << "\nFibonacci Series Is \n\n"; //Fibonacci Series Is given below
cout << a << " " << b << " ";
for (i = 0; i < n; i++)
{
c = a + b; //here adding two previous value
cout << c << " ";
a = b; //swap the value
b = c; //here first two value results are stored in 'b' } //Loop end.
cout << "\n";
return 0;
}
Fibonacci Series
Fibonacci Series in C++: In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterized by the fact that every number after the first two is the sum of the two preceding ones.
Fibonacci Series: 1 ,1 ,2 ,3 ,5 ,8 ,13 ,21 ,34.
Often, especially in modern usage, the sequence is extended by one more initial term.
Fibonacci Series: 0 ,1 ,1 ,2 ,3 ,5 ,8 ,13 ,21 ,34.
The Fibonacci numbers occur in the sums of "shallow" diagonals in Pascal's triangle seen in the given picture
Fibonacci Series: 1 ,1 ,2 ,3 ,5 ,8 ,13 ,21 ,34.
Often, especially in modern usage, the sequence is extended by one more initial term.
Fibonacci Series: 0 ,1 ,1 ,2 ,3 ,5 ,8 ,13 ,21 ,34.
The Fibonacci numbers occur in the sums of "shallow" diagonals in Pascal's triangle seen in the given picture
Important Fact about the Fibonacci Series: 'The 'Golden Ratio' or Phi' of any two consequent numbers of the sequence in the Fibonacci Series in C++ is 1.618 or 1.6 (approx) Except for starting 4 terms.
Example: The first 21 Fibonacci numbers Fn for n = 0, 1, 2, …, 20 are given below.
Fibonacci Series: 0 ,1 ,1 ,2 ,3 ,5 ,8 ,13 ,21 ,34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765.
3 / 2 = 1.500
5 / 3 = 1.667
8 / 5 = 1.600
13 / 8 = 1.625
21 / 13 = 1.615
34 / 21 = 1.619
55 / 34 = 1.617
89 / 55 = 1.618
144 / 89 = 1.618
233 / 144 = 1.618
377 / 233 = 1.618
610 / 377 = 1.618
987 / 610 = 1.618
1597 / 987 = 1.618
2584 / 1597 = 1.618
4181 / 2584 = 1.618
6765 / 4181 = 1.618
Example: The first 21 Fibonacci numbers Fn for n = 0, 1, 2, …, 20 are given below.
Fibonacci Series: 0 ,1 ,1 ,2 ,3 ,5 ,8 ,13 ,21 ,34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765.
3 / 2 = 1.500
5 / 3 = 1.667
8 / 5 = 1.600
13 / 8 = 1.625
21 / 13 = 1.615
34 / 21 = 1.619
55 / 34 = 1.617
89 / 55 = 1.618
144 / 89 = 1.618
233 / 144 = 1.618
377 / 233 = 1.618
610 / 377 = 1.618
987 / 610 = 1.618
1597 / 987 = 1.618
2584 / 1597 = 1.618
4181 / 2584 = 1.618
6765 / 4181 = 1.618
nice job budddddddddyyyyyyyyyyy
ReplyDeleteThanks For Visiting
Deletesir ,plz upload concept of matrix inverse.
ReplyDelete