2022-02-06 16:43:51 +08:00
|
|
|
fn main() {
|
2022-07-04 10:48:13 +08:00
|
|
|
// addition
|
2022-02-06 16:43:51 +08:00
|
|
|
let sum = 5 + 10;
|
|
|
|
|
2022-07-04 10:48:13 +08:00
|
|
|
// subtraction
|
2022-02-06 16:43:51 +08:00
|
|
|
let difference = 95.5 - 4.3;
|
|
|
|
|
2022-07-04 10:48:13 +08:00
|
|
|
// multiplication
|
2022-02-06 16:43:51 +08:00
|
|
|
let product = 4 * 30;
|
|
|
|
|
2022-07-04 10:48:13 +08:00
|
|
|
// division
|
2022-02-06 16:43:51 +08:00
|
|
|
let quotient = 56.7 / 32.2;
|
2023-01-16 17:34:52 +08:00
|
|
|
let truncated = -5 / 3; // 结果为 -1
|
2022-02-06 16:43:51 +08:00
|
|
|
|
2022-07-04 10:48:13 +08:00
|
|
|
// remainder
|
2022-02-06 16:43:51 +08:00
|
|
|
let remainder = 43 % 5;
|
|
|
|
}
|