Permutations: Difference between revisions

Permutations in Yabasic
(Permutations in BASIC256)
(Permutations in Yabasic)
Line 9,553:
esor
</pre>
 
=={{header|Yabasic}}==
{{trans|Liberty BASIC}}
<lang yabasic>n = 4
dim a(n), c(n)
 
for j = 1 to n : a(j) = j : next j
repeat
for i = 1 to n: print a(i);: next: print
i = n
repeat
i = i - 1
until (i = 0) or (a(i) < a(i+1))
j = i + 1
k = n
while j < k
tmp = a(j) : a(j) = a(k) : a(k) = tmp
j = j + 1
k = k - 1
wend
if i > 0 then
j = i + 1
while a(j) < a(i)
j = j + 1
wend
tmp = a(j) : a(j) = a(i) : a(i) = tmp
endif
until i = 0
end</lang>
 
=={{header|zkl}}==
2,130

edits