3个回答
展开全部
Private Sub Form_Click()
Dim N as Integer,A() as Integer
Dim Max as integer,Min as integer,Avg as Integer
N=10
Redim A(1 to n) as Integer
Randomize
Max=0
Min=100
For i=1 to N
A(i)=Int(Rnd*90)+10
if A(i)>Max Then Max=a(i)
If A(i)<Min Then Min=A(i)
Avg=Avg+A(i)
Next
Print "最大值为:" & Max
Print "最小值为:" & Min
Print "平均值为:" & Avg/N
End Sub
Dim N as Integer,A() as Integer
Dim Max as integer,Min as integer,Avg as Integer
N=10
Redim A(1 to n) as Integer
Randomize
Max=0
Min=100
For i=1 to N
A(i)=Int(Rnd*90)+10
if A(i)>Max Then Max=a(i)
If A(i)<Min Then Min=A(i)
Avg=Avg+A(i)
Next
Print "最大值为:" & Max
Print "最小值为:" & Min
Print "平均值为:" & Avg/N
End Sub
展开全部
dim N as integer,i as integer,A() as integer,S as integer,Max as integer
N=inputbox("请输入N的值:")
redim A(N)
S=0
Max=0
for i=1 to n
randomize
a(i)=int(rnd()*90+10)
s=s+a(i)
if max<a(i) then max=a(i)
next i
print "数组的最大值是:";max
print "数组的平均值是:";s/n
N=inputbox("请输入N的值:")
redim A(N)
S=0
Max=0
for i=1 to n
randomize
a(i)=int(rnd()*90+10)
s=s+a(i)
if max<a(i) then max=a(i)
next i
print "数组的最大值是:";max
print "数组的平均值是:";s/n
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Form_Click()
Dim n As Integer
Dim a() As Integer
Dim max As Integer
Dim sum As Double
n = InputBox("请输入n的值", "输入框")
For i = 1 To n
Randomize
ReDim Preserve a(1 To n)
a(i) = Int(Rnd * 99) + 10
List1.AddItem a(i)
sum = sum + a(i)
Next
For j = 1 To n - 1
max = IIf(a(j) > a(j + 1), a(j), a(j + 1))
Next
Debug.Print "最大值是:" & max
Debug.Print "平均值是:" & sum / n
End Sub
Dim n As Integer
Dim a() As Integer
Dim max As Integer
Dim sum As Double
n = InputBox("请输入n的值", "输入框")
For i = 1 To n
Randomize
ReDim Preserve a(1 To n)
a(i) = Int(Rnd * 99) + 10
List1.AddItem a(i)
sum = sum + a(i)
Next
For j = 1 To n - 1
max = IIf(a(j) > a(j + 1), a(j), a(j + 1))
Next
Debug.Print "最大值是:" & max
Debug.Print "平均值是:" & sum / n
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询