Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Fix the Order

This program should calculate the total cost of 3 shirts at $15 each with a $5 discount, but the order of operations is wrong. Fix it!

Expected output:

text
Total: 40
rust
fn main() {
let shirts = 3;
let price = 15;
let discount = 5;

let total = shirts * price - discount + discount;
println!("Total: {}", total);
}