官术网_书友最值得收藏!

Arithmetic expressions

Arithmetic expressions in any language comprise operands and operators. For reference, x and y are used as operands having values 10 and 20, respectively. The following table shows the precedence order:

In an arithmetic expression, generally, the rule of Bracket, Of, Division, Multiplication, Addition, and Subtraction (BODMAS) is followed, and operators have their own precedence order. Exponentiation enjoys a higher precedence order, while addition and subtraction have a lower precedence order.

The decreasing precedence order is as follows:

  • Exponent
  • Unary negation
  • Multiplication, division, modulus
  • Addition, subtraction

If operands are of the same data type, then the resulting value is also of that type. However, addition of two int data types can produce a long integer.

主站蜘蛛池模板: 景宁| 鄂尔多斯市| 赤城县| 乌鲁木齐县| 吉首市| 泸西县| 昌江| 日喀则市| 双柏县| 禹州市| 博客| 韶关市| 抚顺市| 千阳县| 陇川县| 洛宁县| 光泽县| 犍为县| 颍上县| 突泉县| 望谟县| 息烽县| 静安区| 枣庄市| 淮滨县| 江城| 启东市| 靖安县| 邯郸市| 东明县| 新田县| 湄潭县| 闽清县| 英吉沙县| 玛沁县| 芒康县| 桂林市| 安丘市| 兴业县| 佛坪县| 徐汇区|