RosettaCodeData/Task/Combinations/BASIC256/combinations.basic

14 lines
292 B
Plaintext

input "Enter n comb m. ", n
input m
outstr$ = ""
call iterate (outstr$, 0, m-1, n-1)
end
subroutine iterate (curr$, start, stp, depth)
for i = start to stp
if depth = 0 then print curr$ + " " + string(i)
call iterate (curr$ + " " + string(i), i+1, stp, depth-1)
next i
end subroutine