Cody

# Problem 12. Fibonacci sequence

Solution 2039462

Submitted on 29 Nov 2019 by Liam Storan
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
n = 1; f = 1; assert(isequal(fib(n),f))

A = 1 B = 1 f = 1

2   Pass
n = 6; f = 8; assert(isequal(fib(n),f))

A = 1 B = 1 A = 2 B = 1 A = 3 B = 2 A = 5 B = 3 A = 8 B = 5 f = 8

3   Pass
n = 10; f = 55; assert(isequal(fib(n),f))

A = 1 B = 1 A = 2 B = 1 A = 3 B = 2 A = 5 B = 3 A = 8 B = 5 A = 13 B = 8 A = 21 B = 13 A = 34 B = 21 A = 55 B = 34 f = 55

4   Pass
n = 20; f = 6765; assert(isequal(fib(n),f))

A = 1 B = 1 A = 2 B = 1 A = 3 B = 2 A = 5 B = 3 A = 8 B = 5 A = 13 B = 8 A = 21 B = 13 A = 34 B = 21 A = 55 B = 34 A = 89 B = 55 A = 144 B = 89 A = 233 B = 144 A = 377 B = 233 A = 610 B = 377 A = 987 B = 610 A = 1597 B = 987 A = 2584 B = 1597 A = 4181 B = 2584 A = 6765 B = 4181 f = 6765

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!