Created
October 12, 2018 02:41
-
-
Save goFrendiAsgard/9bd4555d5dff852612ebccb09ba51131 to your computer and use it in GitHub Desktop.
First experience with rust
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// filename: coba.rs | |
// compile: rustc coba.rs | |
// run: ./coba | |
// compile and run: rustc coba.rs && ./coba | |
use std::io; | |
fn main() { | |
let stdin = io::stdin(); | |
let mut my_str = String::new(); | |
stdin.read_line(&mut my_str); | |
let my_int_1 = my_str.trim().parse::<i32>().unwrap(); | |
my_str = String::new(); | |
stdin.read_line(&mut my_str); | |
let my_int_2 = my_str.trim().parse::<i32>().unwrap(); | |
let my_int_3 = my_int_1 + my_int_2; | |
println!("{} + {} = {}", my_int_1, my_int_2, my_int_3); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment