trpl-zh-cn/listings/ch03-common-programming-concepts/no-listing-07-numeric-operations/src/main.rs

18 lines
293 B
Rust

fn main() {
// addition
let sum = 5 + 10;
// subtraction
let difference = 95.5 - 4.3;
// multiplication
let product = 4 * 30;
// division
let quotient = 56.7 / 32.2;
let truncated = -5 / 3; // 结果为 -1
// remainder
let remainder = 43 % 5;
}