Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -1,14 +1,13 @@
|
|||
use std::io;
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
#![allow(unstable)] // Currently required whilst Rust 1.0 is finalised
|
||||
let a: i32 = from_str(io::stdin().read_line().unwrap().trim().as_slice()).unwrap();
|
||||
let b: i32 = from_str(io::stdin().read_line().unwrap().trim().as_slice()).unwrap();
|
||||
let args: Vec<_> = env::args().collect();
|
||||
let a = args[1].parse::<i32>().unwrap();
|
||||
let b = args[2].parse::<i32>().unwrap();
|
||||
|
||||
let sum = a + b;
|
||||
println!("a + b = {0}" , sum);
|
||||
println!("a - b = {0}" , a - b);
|
||||
println!("a * b = {0}" , a * b);
|
||||
println!("quotient of a / b = {0}" , a / b); // truncates towards 0
|
||||
println!("remainder of a / b = {0}" , a % b); // same sign as first operand
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue