on 11-05-2008 5:23 AM
Hi,
I need to capture the remainder of a division operation. Ex : 33/9 remainder is 6. I want to know the way to capture the remainder. Can any body help me out.
Regards,
Srinivas
answered
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
MOD : Integer remainder of the division of the left by the right operand
Syntax
[COMPUTE] result = [+|-] operand1
[{+|-|*|/|DIV|MOD|**} [+|-] operand2
[{+|-|*|/|DIV|MOD|**} [+|-] operand3
... ]].
In an arithmetic expression, you can use arithmetic operators to link an operand operand1 with one or more operands operand2, operand3, and so on; parentheses are possible. Arithmetic expressions can only be used in the COMPUTE statement. Each arithmetic expression has a calculation type.
Arunima
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi srinivas,
Use mod operator to get remender.
rem = a mod b.
Thanks,
Krishna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
REPORT zselect_sample.
DATA: gw_mod_val TYPE gjahr,
gw_div_val TYPE gjahr VALUE '39',
gw_res_val TYPE gjahr VALUE '6',
gc_error TYPE REF TO cx_root,
gw_etext TYPE string.
TRY.
gw_mod_val = gw_div_val MOD gw_res_val .
WRITE gw_mod_val.
CATCH cx_root INTO gc_error.
gw_etext = gc_error->get_text( ).
ENDTRY.
Hope That Helps
Anirban M.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
G1 = 25.
G2 = 2.
G3 = G1 MOD G2.
G3 = 1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Use MOD stmt
Regards
Winnie
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.