Anonymous user
Permutations: Difference between revisions
→{{header|Run BASIC}}
Line 2,302:
=={{header|Run BASIC}}==
<lang Runbasic>list$ = "
while word$(list$,d+1,",") <> "" 'Count how many in the list
d = d + 1
wend
dim theList$(d) ' place list in array
for i = 1 to d
theList$(i) = word$(list$,i,",")
next i
for i = 1 to d ' print the Permutations
for j = d to 2 step -1
perm$ = ""
for k = 1 to d
next k
if instr(perms$,perm$+",") = 0 then print perm$
perms$ = perms$ + perm$ + ","
h$ = theList$(j)
theList$(j) = theList$(j - 1)
Line 2,325 ⟶ 2,327:
next i
end</lang>Output:
<pre>
helol
heoll
hoell
ohell
ohlel
olhel
lohel
lohle
lolhe
llohe
lloeh
lleoh
leloh
elloh
ellho
elhlo
▲bacde</pre>
=={{header|SAS}}==
|