Skip to content

TheQueryCrew/P5-FibonacciSequence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fibonacci Sequence

Write A Program To Print The Fibonacci Sequence.

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