28 lines
428 B
Plaintext
28 lines
428 B
Plaintext
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
|