Arithmetic Operations

Top 

 

+   Usage: ae1 + ae2

   Sum of ae1 and ae2.

   Example:

      i = j + 2;

      Sets i equal to j plus 2.

-   Usage: ae1 - ae2

   Subtraction of ae1 and ae2.

   Example:

      i = j - 3;

-   Usage: -ae

 

   Example:

 

*   Usage: ae1 * ae2

   Product of ae1 and ae2.

   Example:

      z = 3 * x

/

   Quotient of ae1 and ae2.

   Example:

      i = j / 5;

%   Usage: ae1 % ae2

   Remainder (modulus division) of the division of ae1 by ae2.

   Example:

     minutes = time % 60;

Note. Execution of the ++ and -- operations produces side effects; the value of variable used as an operand changes.

++  Usage: iv++

   Increasing iv by 1. The value of this expression is the value of ie

   before increasing.

   Example:

     j = i++;

++  Usage: ++iv

   Increasing iv by 1. The value of this expression is the value of ie

   after increasing.

   Example:

     i = ++j;

--  Usage: iv--

   Decreasing iv by 1. The value of this expression is the value of ie

   before decreasing.

   Example:

     j = i--;

--  Usage: --iv

   Decreasing iv by 1. The value of this expression is the value of ie

   after decreasing.

   Example:

     i = --j;