Documentation

Rust
Compiler
Rust
Name
Rust
Language
Rust
Program and version
rustc 1.66.1 (90743e729 2023-01-10) (built from a source tarball)
Description
Rust
Type
compiler
Flags1
-O
Flags2
-O
Extension
.rs
Status
Ok

P68688
fn main() {
    println!("Hello world!");
}
P57548
use std::io;

fn main() {
    let mut sum = 0;

    loop {
        let mut line = String::new();
        if io::stdin().read_line(&mut line).expect("Error reading line") == 0 {
            break;
        }

        for token in line.trim().split(" ") {
            if !token.is_empty() {
                let num: i32 = token.parse().expect("Not an integer");
                sum += num;
            }
        }
    }

    println!("{}", sum);
}