Calculate a total
Multiply the number of items by the price of one item to get the total.
Simple example
Start2 × 3
Result6
fn main() {
println!("{}", (2 * 3));
}
6
Advertisements
Everyday examples
Three notebooks cost 4 each. What is the total?
Start3 × 4
Result12
fn main() {
let notebooks: i64 = 3;
let price: i64 = 4;
println!("{}", (notebooks * price));
}
12