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

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.

主站蜘蛛池模板: 平果县| 福海县| 贵定县| 新巴尔虎右旗| 明溪县| 金昌市| 巴楚县| 甘南县| 紫金县| 萨迦县| 来宾市| 垫江县| 三门峡市| 蓬安县| 随州市| 鄂伦春自治旗| 广饶县| 明光市| 乌兰县| 观塘区| 安岳县| 永安市| 平乐县| 交口县| 新安县| 永仁县| 屯留县| 彰化市| 富源县| 昔阳县| 宁安市| 宿迁市| 衡南县| 灵武市| 兴海县| 义乌市| 长丰县| 抚州市| 安宁市| 罗江县| 湾仔区|