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

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.

主站蜘蛛池模板: 牟定县| 博乐市| 滦平县| 株洲县| 吴堡县| 长宁县| 沂源县| 德令哈市| 文昌市| 东宁县| 子洲县| 青州市| 外汇| 琼海市| 介休市| 井冈山市| 兴海县| 台南市| 缙云县| 水城县| 怀柔区| 龙南县| 海丰县| 喀什市| 长阳| 潮安县| 卢龙县| 丰台区| 衡水市| 迁安市| 咸阳市| 邢台县| 广汉市| 潼关县| 海兴县| 佛坪县| 通山县| 开封市| 安义县| 南汇区| 左权县|