Permutations: Difference between revisions

Content added Content deleted
(Permutations in QBasic)
(Permutations in BASIC256)
Line 1,758: Line 1,758:
Gwen Gwne Genw Gewn Gnwe Gnew wenG weGn wnGe wneG wGen wGne enGw enwG eGwn eGnw ewnG ewGn nGwe nGew nweG nwGe neGw newG
Gwen Gwne Genw Gewn Gnwe Gnew wenG weGn wnGe wneG wGen wGne enGw enwG eGwn eGnw ewnG ewGn nGwe nGew nweG nwGe neGw newG
</pre>
</pre>

=={{header|BASIC256}}==
{{trans|Liberty BASIC}}
<lang BASIC256>arraybase 1
n = 4 : cont = 0
dim a(n)
dim c(n)

for j = 1 to n
a[j] = j
next j

do
for i = 1 to n
print a[i];
next
print " ";

i = n
cont += 1
if cont = 12 then
print
cont = 0
else
print " ";
end if

do
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 += 1
k -= 1
end while
if i > 0 then
j = i + 1
while a[j] < a[i]
j += 1
end while
tmp = a[j] : a[j] = a[i] : a[i] = tmp
end if
until i = 0
end</lang>


=={{header|Batch File}}==
=={{header|Batch File}}==