Cody

Solution 699976

Submitted on 13 Jul 2015 by Brian
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))

prev = 0 current = 1 temp = 1 current = 1 prev = 1 prev = 1

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

prev = 0 current = 1 temp = 1 current = 1 prev = 1 temp = 1 current = 2 prev = 1 temp = 2 current = 3 prev = 2 temp = 3 current = 5 prev = 3 temp = 5 current = 8 prev = 5 temp = 8 current = 13 prev = 8 prev = 8

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

prev = 0 current = 1 temp = 1 current = 1 prev = 1 temp = 1 current = 2 prev = 1 temp = 2 current = 3 prev = 2 temp = 3 current = 5 prev = 3 temp = 5 current = 8 prev = 5 temp = 8 current = 13 prev = 8 temp = 13 current = 21 prev = 13 temp = 21 current = 34 prev = 21 temp = 34 current = 55 prev = 34 temp = 55 current = 89 prev = 55 prev = 55

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

prev = 0 current = 1 temp = 1 current = 1 prev = 1 temp = 1 current = 2 prev = 1 temp = 2 current = 3 prev = 2 temp = 3 current = 5 prev = 3 temp = 5 current = 8 prev = 5 temp = 8 current = 13 prev = 8 temp = 13 current = 21 prev = 13 temp = 21 current = 34 prev = 21 temp = 34 current = 55 prev = 34 temp = 55 current = 89 prev = 55 temp = 89 current = 144 prev = 89 temp = 144 current = 233 prev = 144 temp = 233 current = 377 prev = 233 temp = 377 current = 610 prev = 377 temp = 610 current = 987 prev = 610 temp = 987 current = 1597 prev = 987 temp = 1597 current = 2584 prev = 1597 temp = 2584 current = 4181 prev = 2584 temp = 4181 current = 6765 prev = 4181 temp = 6765 current = 10946 prev = 6765 prev = 6765

Suggested Problems

More from this Author95