Vb.net-arithmetic-operators
提供:Dev Guides
VB.Net-算術演算子
次の表は、VB.Netでサポートされているすべての算術演算子を示しています。 変数 A が2を保持し、変数 B が7を保持すると仮定します-
Operator | Description | Example |
---|---|---|
^ | Raises one operand to the power of another | B^A will give 49 |
+ | Adds two operands | A + B will give 9 |
- | Subtracts second operand from the first | A - B will give -5 |
* | Multiplies both operands | A* B will give 14 |
/ | Divides one operand by another and returns a floating point result | B/A will give 3.5 |
\ | Divides one operand by another and returns an integer result | B \ A will give 3 |
MOD | Modulus Operator and remainder of after an integer division | B MOD A will give 1 |
例
VB.Netで利用可能なすべての算術演算子を理解するために、次の例を試してください-
上記のコードをコンパイルして実行すると、次の結果が生成されます-