This challenge is about basic mathematical operations. You will be given 2 numbers a and b. You need to perform the following operations:
- Sum of
aandb - Difference of
aandb - Multiplication of
aandb - Division of
aandb
You need to return a tuple containing the results of the above operations in the same order. (sum, difference, multiply, divide)
Note that every value in the tuple must be of type
i32.
Example
let a = 10;let b = 5;let result = math_operations(a, b);assert_eq!(result, (15, 5, 50, 2));
Hints
In Rust you can use the following operators for the above operations:
- Sum:
+ - Difference:
- - Multiplication:
* - Division:
/
Good luck!
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) {// TODO: Return a tuple of 4 values: (sum, difference, multiply, divide)}