Thursday, 21 September 2017

ABAP: Arithmetic Operators

Arithmetic operators are used to perform arithmetic operations between operands.

Operator
Description
+
Perform addition
-
Perform subtraction
*
Perform Multiplication
/
Perform Division
mod
Gives remainder. Ex: operand1 MOD operand2

Z_HELLO_WORLD
*&---------------------------------------------------------------------*
*& Report Z_HELLO_WORLD
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT Z_HELLO_WORLD.

DATA: var1 TYPE I VALUE 25,
      var2 TYPE I VALUE 10,
      result TYPE I.

result = var1 + var2.
Write / result.

result = var1 - var2.
Write / result.

result = var1 * var2.
Write / result.

result = var1 / var2.
Write / result.

result = var1 mod var2.
Write / result.



Previous                                                 Next                                                 Home

No comments:

Post a Comment