Rust-arithmetic-operators
提供:Dev Guides
Rust-算術演算子
変数aおよびbの値がそれぞれ10および5であると仮定します。
Sr.No | Operator | Description | Example |
---|---|---|---|
1 | +(Addition) | returns the sum of the operands | a+b is 15 |
2 | -(Subtraction) | returns the difference of the values | a-b is 5 |
3 | * (Multiplication) | returns the product of the values | a*b is 50 |
4 | /(Division) | performs division operation and returns the quotient | a/b is 2 |
5 | % (Modulus) | performs division operation and returns the remainder | a % b is 0 |
注意-++および-演算子はRustではサポートされていません。