RosettaCodeData/Task/Combinations/OpenEdge-Progress/combinations.openedge

20 lines
504 B
Plaintext

define variable r as integer no-undo extent 3.
define variable m as integer no-undo initial 5.
define variable n as integer no-undo initial 3.
define variable max_n as integer no-undo.
max_n = m - n.
function combinations returns logical (input pos as integer, input val as integer):
define variable i as integer no-undo.
do i = val to max_n:
r[pos] = pos + i.
if pos lt n then
combinations(pos + 1, i).
else
message r[1] - 1 r[2] - 1 r[3] - 1.
end.
end function.
combinations(1, 0).