RosettaCodeData/Task/Integer-comparison/Rust/integer-comparison.rust

20 lines
535 B
Text
Raw Permalink Normal View History

2015-11-18 06:14:39 +00:00
use std::io::{self, BufRead};
2015-02-20 00:35:01 -05:00
fn main() {
2015-11-18 06:14:39 +00:00
let mut reader = io::stdin();
let mut buffer = String::new();
let mut lines = reader.lock().lines().take(2);
let nums: Vec<i32>= lines.map(|string|
string.unwrap().trim().parse().unwrap()
).collect();
let a: i32 = nums[0];
let b: i32 = nums[1];
if a < b {
println!("{} is less than {}" , a , b)
} else if a == b {
println!("{} equals {}" , a , b)
} else if a > b {
println!("{} is greater than {}" , a , b)
};
2015-02-20 00:35:01 -05:00
}