This challenge is about basic mathematical operations. You will be given 2 numbers a
and b
. You need to perform the following operations:
a
and b
a
and b
a
and b
a
and b
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
.
In Rust you can use the following operators for the above operations:
+
-
*
/
Good luck!
CB-42458
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) (a+b, a-b, a*b, a/b)}
admarton
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) return (a+b, a-b, a*b, a/b);}
quantumxt
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) (a+b, a-b, a*b, a/b)}
SomeRandomRedneck
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) let sum = a + b; let diff = a - b; let mult = a * b; let div = a / b; (sum, diff, mult, div)}
herlock77
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) (a + b, a - b, a * b, a / b)}
Alienora
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { (a+b, a-b, a*b,a/b)}
GideonBature
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) (a + b, a - b, a * b, a / b)}
JaiSuryaPrabu
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { return (a+b,a-b,a*b,a/b);}
nerudxlf
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) return (a + b, a - b, a * b, a / b);}
lexara-prime-ai
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) (a + b, a - b, a * b, a / b)}
lexara-prime-ai
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) (a + b, a - b, a * b, a / b)}
istominrs
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) (a+b, a-b, a*b, a/b)}
Johan-smal
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) (a + b, a - b, a * b, a / b)}
TheMj0ln1r
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) (a+b, a-b, a*b, a/b)}
enzo-rma
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) return (a + b, a - b, a * b, a / b)}
Squirkyy
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) return (a+b, a-b, a*b, a/b);}
anojht
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) return (a+b, a-b, a*b, a/b)}
Bethel-nz
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // Calculate the sum, difference, product, and quotient let sum = a + b; let difference = a - b; let product = a * b; let divide = a / b; // Return a tuple containing the results (sum, difference, product, divide)}
BlakeEric
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // Return a tuple of 4 values: (sum, difference, multiply, divide) // Each value should be the result of the corresponding operation on a and b return (a + b, a - b, a * b, a / b);}
poeck
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { let sum = a + b; let dif = a - b; let mul = a * b; let div = a / b; return (sum, dif, mul, div);}
MrSingh2000
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // Return a tuple of 4 values: (sum, difference, multiply, divide) // Each value should be the result of the corresponding operation on a and b let sum: i32 = a + b; let diff: i32 = a - b; let mul: i32 = a * b; let div: i32 = a / b; let myTuple: (i32, i32, i32, i32) = (sum, diff, mul, div); return myTuple;}
foxy4096
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // Return a tuple of 4 values: (sum, difference, multiply, divide) // Each value should be the result of the corresponding operation on a and b (a+b, a-b, a*b, a/b)}
dcodes
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { /* Hello, world! What did you think? */ (a+b, a-b, a*b,a/b)}