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!
leenalmajz
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 difference = a - b; let multiply = a * b; let divide = a / b ; return (sum, difference, multiply, divide)}
garanast
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 as i32)}
dpey
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { let sum = a + b; let diff = a - b; let mul = a * b; let div = a / b; return (sum, diff, mul, div);}
Thymelizabeth
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)}
Derteq
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { (a + b, a - b, a * b, a / b)}
devarajang
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 as i32);}
amilcarrey
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:i32 = a+b; let diff:i32 = a-b; let mul:i32 = a*b; let div:i32 = a/b; return (sum, diff, mul, div)}
SCBenson
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 difference = a - b; let multiply = a * b; let divide = a / b; return (sum, difference, multiply, divide)}
jeypiti
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)}
konishu
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 difference = a - b; let multiply = a * b; let divide = a / b; return (sum, difference, multiply, divide);}
nichideropa
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)}
aleksey-vareto
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)}
akshayabhattarai
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)}
M4dPac
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)}
oDqnger
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { (a+b, a-b, a*b, a/b)}
martin-unit
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)}
kk6
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 sub = a - b; let mul = a * b; let div = a / b; (sum, sub, mul, div)}
otakumesi
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 )}
matsumura-y1
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)}
matsuyama-k1
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 difference = a-b; let multiply = a*b; let division = a/b; return (sum,difference,multiply,division)}
sy34
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);}
matsuby
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { let sum = a + b; let diff = a - b; let mul = a * b; let div = a / b; return (sum, diff, mul, div);}
ankeetparikh
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { (a + b, a - b, a * b, a / b)}
0xsmarter
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)}
aidan1magee
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)}
maxvi
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { (a+b, a-b, a*b, a/b)}
johandroid
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)}
hfm
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)}
P0TER19
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { // TODO: Return a tuple of 4 values: (sum, difference, multiply, divide) let tup:(i32, i32, i32, i32)=(a+b,a-b,a*b,a/b); return tup}
whatyoubendoing
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { return (a+b, a-b, a * b, a/ b);}
WalquerX
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)}
rafaellucasprogm
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 difference = a - b; let multiply = a * b; let divide = a / b; (sum, difference, multiply, divide)}
rafaellucasprogm
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 difference = a - b; let multiply = a * b; let divide = a / b; return (sum, difference, multiply, divide)}
koslowskio
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)}
cloki0610
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)}
Brack0
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) { (a + b, a - b, a * b, a / b)}
dalprahcd
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 dif = a-b; let mul = a*b; let div = a/b; (sum, dif, mul, div)}
tsucchinoko
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 difference = a - b; let multiply = a * b; let divide = a / b; (sum, difference, multiply, divide)}
shinuza
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)}
prajval-malhotra
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: i32 = a + b; let difference: i32 = a - b; let product: i32 = a * b; let division: i32 = a / b; return (sum, difference, product, division);}
whitwulf
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 mul = a * b; let div = a / b; (sum, diff, mul, div)}
risemacro
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)}
soheeey
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)}
ugochukwudev
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 dif = a-b; let multiply = a *b; let divide = a/b; println!("dif is: {}, a is {} and b is {}",dif,a,b); (sum,dif,multiply,divide)}
Kobeieii
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)}
Samthewriter77
pub fn math_operations(a: i32, b: i32) -> (i32, i32, i32, i32) {(a+b,a-b,a*b,a/b)}
harryherold
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)}
fudjet
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 difference = a - b; let multiply = a * b; let divide = a / b; (sum, difference, multiply, divide)}
tsubasa-s
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)}
lewis-disaster-response
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);}