07-25-2008 2:33 PM
experts,
if i divide a variable of type i, how to get its quotient and remainder at the same time,
if we use mod we only get remainder and if we use div we get
only quotient then how to get both the values at a time.
thanks and regards.
07-25-2008 2:45 PM
hi,
What is the Need for such operation at the same time?
Sumit Agarwal
07-25-2008 2:53 PM
So if you want the values at the same time, then put the two statements in the same line of code.
.
data: lv_value type i value 20.
data: Lv_quotient type p decimals 2.
data: lv_remainder type p DECIMALS 2.
lv_quotient = floor( lv_value / 3 ). lv_remainder = floor( lv_value mod 3 ).
write:/ lv_quotient.
write:/ lv_remainder.
Yes, I know, this is not what you were looking for, but I think that there is no way to put these two operations into one statement.
Regards,
Rich Heilman
07-25-2008 2:53 PM
hi check this..
for the remainder use mod operation
for the quotient use / operation
data: test type i value 9,
test1 type i value 2,
rem type i ,
quot type p decimals 2 .
rem = test mod test1 .
quot = test / test1 .
write:/ rem , quot .
07-26-2008 7:59 AM
07-26-2008 8:29 AM
hi,
Div - integer division operators
var = 3 Div 2.
var = 1.
/ - Quotient
var1 = 3 / 2.
var1 = 2.
Regards
Sumit Agarwal