Rust Sample - while

mohadang·2023년 7월 30일
0

Rust Sample

목록 보기
8/16
post-thumbnail
use std::io;

fn main() {
    let mut inputs1 = String::new();
    let mut inputs2 = String::new();

    if let (Ok(_), Ok(_)) = (
        io::stdin().read_line(&mut inputs1),
        io::stdin().read_line(&mut inputs2),
    ) {
        if let (Ok(a), Ok(b)) = (
            inputs1.trim().parse::<i32>(), 
            inputs2.trim().parse::<i32>(),
        ) {
            let mut x = b;
            while x > 0 {
                println!("{}", a * (x % 10));
                x /= 10;
            }
            println!("{}", a * b);
        }
    }
}
profile
mohadang

0개의 댓글