Question: What missing code should be added to this class to ensure that calling fibonacci ( 6 ) returns 8 ? class TEST feature fibonacci (

What missing code should be added to this class to ensure that calling fibonacci(6) returns 8?
class TEST
feature
fibonacci(n: INTEGER): INTEGER
do
if n <=1 then
Result := n
else
Result :=___-- missing code here
end
end
end
2
a.
fibonacci(n -1)+ fibonacci(n -3)
b.
fibonacci(n -1)+ fibonacci(n -2)
c.
fibonacci(n -2)+ n
d.
fibonacci(n -1)+ n

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!