Private Sub Command1_Click()
Dim i As Integer, j As Integer, exchange As Integer, a(9) As Integer
For i = 0 To 9
Randomize
a(i) = Rnd * (101)
Next i
For i = 1 To 9
For j = 0 To 9 - i
If a(j) > a(j + 1) Then
exchange = a(j)
a(j) = a(j + 1)
a(j + 1) = exchange
End If
Next j
Next i
For j = 0 To 9
Print a(j)
Next j
End Sub
Private Sub Form_Load()
Dim A(1 To 10) As Integer
For I = 1 To 10
Randomize
A(I) = Int(Rnd * 100 + 1)
Next I
For I = 1 To 9
For J = 1 To 10 - I
If A(J) < A(J + 1) Then
XX = A(J)
A(J) = A(J + 1)
A(J + 1) = XX
End If
Next J
Next I
For I = 1 To 10
Text1.Text = Text1.Text & A(I) & " "
Next I
End Sub