|
|
@ -4,27 +4,15 @@ |
|
|
|
|
|
|
|
|
|
|
|
Complete the body of the **function** `fibonacci`. |
|
|
|
Complete the body of the **function** `fibonacci`. |
|
|
|
|
|
|
|
|
|
|
|
This function receives a number `n` and returns the `n`th number in the fibonacci series. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The Fibonacci Series starts like this: 0, 1, 1, 2, 3, 5, 8, 13 etc... |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Recommendation |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Videos designed to give **hints** are assigned to each quest. It is strongly suggested to watch them as you go. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Notions |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- [Primitives](https://doc.rust-lang.org/stable/rust-by-example/primitives.html) |
|
|
|
|
|
|
|
- [Functions](https://doc.rust-lang.org/stable/rust-by-example/fn.html) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Expected function |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```rust |
|
|
|
```rust |
|
|
|
pub fn fibonacci(n: u32) -> u32 { |
|
|
|
pub fn fibonacci(n: u32) -> u32 { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This function receives a number `n` and returns the `n`th number in the fibonacci series. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The Fibonacci Series starts like this: 0, 1, 1, 2, 3, 5, 8, 13 etc... |
|
|
|
|
|
|
|
|
|
|
|
### Usage |
|
|
|
### Usage |
|
|
|
|
|
|
|
|
|
|
|
Here is a possible test for your function: |
|
|
|
Here is a possible test for your function: |
|
|
@ -50,3 +38,8 @@ The element in the position 22 in fibonacci series is 17711 |
|
|
|
The element in the position 20 in fibonacci series is 6765 |
|
|
|
The element in the position 20 in fibonacci series is 6765 |
|
|
|
$ |
|
|
|
$ |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Notions |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- [Primitives](https://doc.rust-lang.org/stable/rust-by-example/primitives.html) |
|
|
|
|
|
|
|
- [Functions](https://doc.rust-lang.org/stable/rust-by-example/fn.html) |
|
|
|