mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nprimo
118cf8457f
|
2 years ago | |
---|---|---|
.. | ||
README.md | 2 years ago |
README.md
min_and_max
Instructions
Create a function named min_and_max
that receives three i32
and returns a tuple
with the minimum and the maximum number received as input.
pub fn min_and_max(nb_1: i32, nb_2: i32, nb_3: i32) -> (i32, i32) {
}
Usage
Here is a program to test your function
use min_and_max::min_and_max;
fn main() {
let nb_1 = 9;
let nb_2 = 4;
let nb_3 = 2;
let (min, max) = min_and_max(nb_1, nb_2, nb_3);
println!(
"The minimum is {}, the maximum is {}",
min, max
);
}
And its output
$ cargo run
The minimum is 2, the maximum is 9
$