zettacode.files/arithmetic.integer/rust.txt in zettacode-0.1.0 vs zettacode.files/arithmetic.integer/rust.txt in zettacode-0.1.1

- old
+ new

@@ -1,15 +1,15 @@ -N c c b u [:.u-. Ru ] u c u. -u d::v +Note that this code cannot be run within the [http://play.rust-lang.org Rust playpen] as it does not support console input. +use std::env; -f () { - : Vc_ = ::().cc() - = [1].::32().u() - b = [2].::32().u() +fn main() { + let args: Vec<_> = env::args().collect(); + let a = args[1].parse::<i32>().unwrap(); + let b = args[2].parse::<i32>().unwrap(); - !("u: {}", + b) - !("ffc: {}", - b) - !("uc: {}", * b) - !(" qu: {}", b) uc z - !(": {}", % b) f + println!("sum: {}", a + b); + println!("difference: {}", a - b); + println!("product: {}", a * b); + println!("integer quotient: {}", a / b); // truncates towards zero + println!("remainder: {}", a % b); // same sign as first operand }