Imports System
Public Module Module1
Public Sub Main()
bubble_sort
End Sub
Sub bubble_sort()
Dim I, J, Temp, Length as Integer
Dim Array() as string = {5,6,2,9,1,8}
length = array.length
for x = 0 to length
console.write(array(x) & " ")
next
For i = length - 1 to 0 step -1
for j = 0 to I - 1
If array(J) > array (j + 1) then
temp = array(J)
array(J) = array(J + 1)
array(J + 1) = Temp
end if
for y = 0 to length
console.write(array(y) & " ")
end sub
End Module