diff --git a/subjects/fibonacci2/README.md b/subjects/fibonacci2/README.md index 7cd2af06..681e4633 100644 --- a/subjects/fibonacci2/README.md +++ b/subjects/fibonacci2/README.md @@ -2,12 +2,21 @@ ### Instructions -Complete the body of the function `fibonacci`. +Complete the body of the **function** `fibonacci`. -This functions receives a number n and returns the nth number in the fibonacci series. +This functions receives a number `n` and returns the nth number in the fibonacci series. -The Fibonacci Series starts like this: 0, 1, 1, 2, 3, 5, 8, 13... so fibonacci(2) = 1 and fibonnacci(4) = 3 +The Fibonacci Series starts like this: 0, 1, 1, 2, 3, 5, 8, 13 etc... +Each number in the series is calculated by the summing of the two previous ones (With the exception of the two first ones which are defined as 0 and 1). +- so fibonacci(2) = 1 (1 + 1) +- and fibonnacci(4) = 3 (1 + 2) +### TNotions + +#### 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 @@ -42,4 +51,3 @@ The element in the position 22 in fibonacci series is 17711 The element in the position 20 in fibonacci series is 6765 student@ubuntu:~/[[ROOT]]/test$ ``` - diff --git a/subjects/scalar/README.md b/subjects/scalar/README.md index c7c20e72..6f86ed9d 100644 --- a/subjects/scalar/README.md +++ b/subjects/scalar/README.md @@ -1,43 +1,52 @@ -## Scaler +## Scalar ### Instructions -Create the following functions, that receives two parameters: -- sum, that returns the sum between two values from 0 to 255 -- diff, that returns the difference between two values from -32768 to 32767 -- pro, that returns the product of the multiplication between two values from -128 to 127 -- quo, that returns the quotient of the division between two values -- rem, that returns the remainder of the division between two values +Create the following **functions**, which each receives two parameters: +- `sum`, which returns the sum between two values from 0 to 255 +- `diff`, which returns the difference between two values from -32768 to 32767 +- `pro`, which returns the product of the multiplication between two values from -128 to 127 +- `quo`, which returns the quotient of the division between two values (32bit and you have to figure out the second part) +- `rem`, which returns the remainder of the division between two values (32bit and you have to figure out the second part) + +You **must** complete the Expected functions parameters data type accordingly (Replace the Xs)! + ### Notions - https://doc.rust-lang.org/book/ch03-02-data-types.html -### Expected functions +### Expected functions (Incomplete, you must precise the Data Types) ```rust -pub fn sum(a:, b: ) -> { +pub fn sum(a: X , b: X) -> X { } -pub fn diff(a: , b: ) -> { +pub fn diff(a: X, b: X) -> X { } -pub fn pro(a: , b: ) -> { +pub fn pro(a: X, b: X) -> X { } -pub fn quo(a: , b: ) -> { +pub fn quo(a: X, b: X) -> X { } -pub fn rem(a: , b: ) -> { +pub fn rem(a: X, b: X) -> X { } ``` -### Usage: +### Usage (do not forget to comment the ERROR test if you want to use all the tests): ```rust +use scalar::sum; +use scalar::diff; +use scalar::pro; +use scalar::quo; +use scalar::rem; + fn main() { // sum println!("sum : {}", sum(234, 2));