Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 483 Bytes

fibonacci_series.md

File metadata and controls

21 lines (14 loc) · 483 Bytes

Problem Statement

As we saw earlier, the Fibonacci sequence is a series of numbers where every number is the sum of the two numbers before it. The first two numbers are 0 and 1:

0 1 1 2 3 5 8 13

You must write the fib() function which takes in a positive integer, n, and returns the n-th Fibonacci number. However, instead of using recursion, your function must use any of the loops.

Sample Input

n = 7

Sample Output

8