In mathematics, a series such that each number is the sum of the two previous ones, starting from 0 and 1, known as Fibonacci series. The terms in this series can be signified as :- a, b, a+b, a+2b, 2a+3b, 3a+5b, 5a+8b, ....... so on.
What is the nth Fibonacci number?
Nth term of the series is sum of the two previous ones, which is [ Fn = Fn-1 + Fn-2 ], where "Fn" is the Nth term of series and "Fn-1" and "Fn-2" are first previous term and second previous term of series.
How do you display the Fibonacci series?
- Take value of N from user. Where N is number of terms in the series.
- Use loop to display every terms and swap value of variable "a" and "b".
- Initial value of variable "a" and "b" are 0 and 1.
- Loop range will be from 1 to N.
- Display the terms of the series as result.
Program to find sum of the Fibonacci series.
- C program to display series.
- C++ program to display series.
- Java program to display series.
Recursive program to display the Fibonacci series.
- C program to display series using recursion.
- C++ program to display series using recursion.
- Java program to display series using recursion.
C program to display series.
Output :-
Type any number >>| 10
Here is your series....
1 + 1 + 2 + 3 + 5 + 8 + 13 + 21 + 34 + 55
C++ program to display series.
Output :-
Type any number >>| 10
Here is your series....
1 + 1 + 2 + 3 + 5 + 8 + 13 + 21 + 34 + 55
Java program to display series.
Output :-
Type any number >>| 7
Here is your series....
1 + 1 + 2 + 3 + 5 + 8 + 13
C program to display series using recursion.
Output :-
Type any number >>| 10
Here is your series....
1 + 1 + 2 + 3 + 5 + 8 + 13 + 21 + 34 + 55
C++ program to display series using recursion.
Output :-
Type any number >>| 10
Here is your series....
1 + 1 + 2 + 3 + 5 + 8 + 13 + 21 + 34 + 55
Java program to display series using recursion.
Output :-
Type any number >>| 7
Here is your series....
1 + 1 + 2 + 3 + 5 + 8 + 13
Attention readers! Don't stop learning now. Check out our articles to gain more knowledge.
0 Comments
If you have any doubt. Let me know.