#!/usr/bin/yabasic sub printarray(a, aLength) for i = 1 to aLength print a(i); next i print end sub sub combsort(a, aLength) gap = aLength repeat gap = int((gap * 10) / 13) if gap = 9 or gap = 10 then gap = 11 endif if gap < 1 then gap = 1 endif swapped = 0 for i = 1 to aLength - gap j = i + gap if a(i) > a(j) then temp = a(i) a(i) = a(j) a(j) = temp swapped = 1 endif next i until (gap = 1 and not swapped) end sub aLength = 10 dim a(aLength) data 1, 6, 5, 3, 8, 9, 7, 2, 4, 0 for i = 1 to aLength read a(i) next i combsort(a, aLength) printarray(a, aLength) end