Answers for "rust multiplication table for a number"

0

rust multiplication table for a number

// create multiplication table for a number
fn multiplication(n: u64) -> String {
    (1..=12).map(|i| format!("{} * {} = {}", i, n, i * n)).collect::<Vec<_>>().join("\n")
}

fn main() {
    println!("{}", multiplication(7));
}
Posted by: Guest on March-13-2021

Code answers related to "rust multiplication table for a number"

Browse Popular Code Answers by Language