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.
davhojt
f226f3b98a
|
2 years ago | |
---|---|---|
.. | ||
README.md | 2 years ago |
README.md
division_and_remainder
Instructions
Create a function named divide
that receives two i32
and returns a tuple
. The first element is the result of the integer division between the two numbers, and the second is the remainder of the division.
pub fn divide(x: i32, y: i32) -> (i32, i32) {
}
Usage
Here is a program to test your function
use division_and_remainder::divide;
fn main() {
let x = 9;
let y = 4;
let (division, remainder) = divide(x, y);
println!(
"{}/{}: division = {}, remainder = {}",
x, y, division, remainder
);
}
And its output
$ cargo run
9/4: division = 2, remainder = 1
$