Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

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("
")
}

fn main() {
    println!("{}", multiplication(7));
}
 
PREVIOUS NEXT
Tagged: #rust #multiplication #table #number
ADD COMMENT
Topic
Name
5+3 =