Fibonacci Sequence:
In mathematics, the Fibonacci numbers, commonly denoted Fn, form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. The sequence starts: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ....
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)
- the 5 is (2+3), and so on!
Input:
Enter number of elements required : 4
Output:
Fibonacci Sequence for 4 elements is : 0, 1, 1, 2