<%
dim numamt, nummax, nummin, ar(100), tmp
numamt = 5 : nummax = 100 : nummin = 50
response.write("Before sorted by bubble sort<br>")
randomize
for i = 1 to numamt
ar(i) = int(nummin + (rnd * ( nummax - nummin + 1 )))
response.write( i & " : " & ar(i) & "<br>")
next
for i = 2 to numamt
for j = numamt to i step -1
if ar(j-1) > ar(j) then
tmp = ar(j-1)
ar(j-1) = ar(j)
ar(j) = tmp
end if
next
next
response.write("<hr>After sorted by bubble sort<br>")
for i = 1 to numamt
response.write( i & " : " & ar(i) & "<br>")
next
%>
จำนวน : 23 บรรทัด