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