The Rexx language supports the normal Arithmetic Operators as any the language. Following are the Arithmetic Operators available in Rexx.
|+||Addition of two operands||1 + 2 will give 3|
|−||Subtracts second operand from the first||1 - 2 will give -1|
|∗||Multiplication of both operands||2 ∗ 2 will give 4|
|/||Division of numerator by denominator||2 / 2 will give 1|
|//||Remainder of dividing the first number by the second||3 // 2 will give 1|
|%||The div component will perform the division and return the integer component.||3 % 2 will give 1|
The following program shows how the various operators can be used.
/* Main program*/ X = 40 Y = 50 Res1 = X + Y Res2 = X - Y Res3 = X * Y Res4 = X / Y Res5 = X % Y Res6 = X // Y say Res1 say Res2 say Res3 say Res4 say Res5 say Res6
The output of the above program will be −
90 -10 2000 0.8 0 40