2008 Oct 03 12:31 PM
for 3x + 4y + 2z LE 25 i want all possible values can any body suggest me.pls?
2008 Oct 03 1:20 PM
Hello
Try this code:
data: x type i,
y type i,
z type i,
sum type i.
data: begin of itab occurs 0,
x type i,
y type i,
z type i,
end of itab.
x = y = z = 0.
do 6 times.
x = x + 1.
do 5 times.
y = y + 1.
do 9 times.
z = z + 1.
sum = x * 3 + y * 4 + z * 2.
if sum <= 25.
itab-x = x.
itab-y = y.
itab-z = z.
append itab.
endif.
enddo.
z = 0.
enddo.
y = 0.
enddo.
In result table ITAB will be all possible values (natural numbers, without zeros).
If you need with zeros - modify this code itself
2008 Oct 03 12:34 PM
In a loop increment the value of x, y , and z and each time check LE 25 , If so append the values of x ,y,z into an internal table,
What is your actual requirement? ant value cab be assigned to x , y , z.
Regards,
Midhun Abraham
Edited by: Midhun Abraham on Oct 3, 2008 1:34 PM
Edited by: Midhun Abraham on Oct 3, 2008 1:35 PM
2008 Oct 03 1:20 PM
Hello
Try this code:
data: x type i,
y type i,
z type i,
sum type i.
data: begin of itab occurs 0,
x type i,
y type i,
z type i,
end of itab.
x = y = z = 0.
do 6 times.
x = x + 1.
do 5 times.
y = y + 1.
do 9 times.
z = z + 1.
sum = x * 3 + y * 4 + z * 2.
if sum <= 25.
itab-x = x.
itab-y = y.
itab-z = z.
append itab.
endif.
enddo.
z = 0.
enddo.
y = 0.
enddo.
In result table ITAB will be all possible values (natural numbers, without zeros).
If you need with zeros - modify this code itself
2008 Oct 04 6:11 AM