Question: Problem 2 The Fibonace i sequence 1 , 1 , 2 , 3 , 5 , 8 , 1 3 , 2 1 dotsdots starts

Problem 2
The Fibonace i sequence 1,1,2,3,5,8,13,21dotsdots starts with two 1 s , and each term
afterwards is the sum of its two predecessors. Please write a function, Fib(n), which
takes n as the input parameter. It will return the n -th number in the Fibonacci
sequence.
Testing commands: Fib(1); Fib(2); Fib(100)
Use loop
Use recursion
Problem 2 The Fibonace i sequence 1 , 1 , 2 , 3 ,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!