我想用vb设计一个程序:用一组数中的最大值减去最小值后,再除以这组数的的平均数,不过我不会,谢

烟-草 1年前 已收到1个回答 举报

珠海08 幼苗

共回答了18个问题采纳率:100% 举报

Dim i, max, min, avg, sum As Integer
For i = 0 to UBound(数组)
If i = 0 Then
min = 数组(0)
max = 数组(0)
End If
If max < 数组(i) then
max = 数组(i)
End if
If min > 数组(i) then
min = 数组(i)
End if
sum = sum + 数组(i)
Next i
Debug.Print cstr((max-min)/(sum/(UBound(数组)+1)))

1年前

4
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 0.030 s. - webmaster@yulucn.com