form添加一个按钮,点击就是结果
Private Sub Command1_Click()
Dim i, j, k, sum, imax, iavg, a(1 To 10)
j = 0: sum = 0: imax = 0: iavg = 0
For i = 1 To 10
Do
j = InputBox("请输入第 " & i & " 个整数:")
Loop While IsNumeric(j) = False
a(i) = j
sum = sum + j
If j > imax Then imax = j
Next i
iavg = sum / 10
For i = 1 To 9
For j = i + 1 To 10
If a(j) < a(i) Then
k = a(j)
a(j) = a(i)
a(i) = a(j)
End If
Next j
Next i
For i = 1 To 10
Print a(i)
Next i
End Sub
循环对比排列.
然后+之/10
输出.