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

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.

主站蜘蛛池模板: 通道| 威信县| 海城市| 阆中市| 普洱| 宽甸| 丰台区| 苏尼特右旗| 攀枝花市| 公主岭市| 阳高县| 新竹市| 江达县| 班戈县| 盐边县| 洪江市| 鹿泉市| 达尔| 江陵县| 沭阳县| 固原市| 隆子县| 兴国县| 麻栗坡县| 台湾省| 平湖市| 邛崃市| 阿尔山市| 陇西县| 耒阳市| 温泉县| 瓦房店市| 富川| 绥中县| 双柏县| 建平县| 区。| 大名县| 呼玛县| 宁陵县| 西峡县|