Use the MOD operator
i am giving u an example
DATA: COUNTER TYPE I.
COMPUTE COUNTER = COUNTER + 1.
COUNTER = COUNTER + 1.
ADD 1 TO COUNTER.
Here, the three operational statements perform the same arithmetic operation, i.e. adding 1 to the contents of the field COUNTER and assigning the result to COUNTER.
DATA: PACK TYPE P DECIMALS 4,
N TYPE F VALUE '+5.2',
M TYPE F VALUE '+1.1'.
PACK = N / M.
WRITE PACK.
PACK = N DIV M.
WRITE / PACK.
PACK = N MOD M.
WRITE /PACK.
The output appears as follows:
4.7273
4.0000
0.8000
REWARD POINTS IF USEFUL
Hi,
I think you should use mod operator to get reminder not % operator
Example
DATA: D1 TYPE I, D2 TYPE I, D3 TYPE I, D4 TYPE I,
M1 TYPE P DECIMALS 1, M2 TYPE P DECIMALS 1,
M3 TYPE P DECIMALS 1, M4 TYPE P DECIMALS 1,
PF1 TYPE F VALUE '+7.3',
PF2 TYPE F VALUE '+2.4',
NF1 TYPE F VALUE '-7.3',
NF2 TYPE F VALUE '-2.4'.
D1 = PF1 DIV PF2. M1 = PF1 MOD PF2.
D2 = NF1 DIV PF2. M2 = NF1 MOD PF2.
D3 = PF1 DIV NF2. M3 = PF1 MOD NF2.
D4 = NF1 DIV NF2. M4 = NF1 MOD NF2.
The variables now have the following values:
D1 = 3, M1 = 0.1,
D2 = - 4, M2 = 2.3,
D3 = - 3, M3 = 0.1,
D4 = 4, M4 = 2.3.
Hi,
% this operator will use only for characters finding.
example u have
sunil kumar
praveenkumar
anilkumar
if u %kumar then it will display all names which is having kumar
in ur program if u want display 1 instead of 301 just do shift operator.
reward me a points if it is use full answer.
praveen
Add a comment