C++ program to display fibonacci series

C++ program to display fibonacci series
The Fibonacci sequence is a set of numbers that starts with a one or a zero, followed by a one, and proceeds based on the rule that each number (called a Fibonacci number) is equal to the sum of the preceding two numbers.
The next number is found by adding up the two numbers before it.
The 2 is found by adding the two numbers before it (1+1)
The 3 is found by adding the two numbers before it (1+2),
And the 5 is (2+3),
and so on!

The Fibonacci Sequence is the series of numbers:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...

The recurrence relation that defines the Fibonacci numbers is as follows

F(n) = F(n-1) + F(n-2) where  F(0)=0 and F(1)=1

Example : C++ program to generate Fibonacci series up to n number of terms


Output

Enter the number of terms : 10
Fibonacci Series is   0 1 1 2 3 5 8 13 21 34

Example : C++ program to generate Fibonacci sequence up to a certain number


Output

Enter a positive number: 100
Fibonacci Series is 0 1 1 2 3 5 8 13 21 34 55 89

Example : C++ program to generate Fibonacci sequence up to n number of term recursive programming


Output

Enter the number of terms : 5
Fibonacci Series is 0 1 1 2 3

Post a Comment

Thank you for vising

أحدث أقدم