随机生成10个两位数,并求最小值和位置
求代码,随机生成10个两位数,最小值和位置
'仅显示,不计算
dim a as long ,m1 as long ,m2 as long
dim i as long,s as string
m1=999 '最小值,先给个超大值
for i=1 to 10
a=10+int( rnd()*90)
if m1>a then m1=a '最小值
if m2<a then m2=a '最大值
s=s & "," & a
next i
s="10个数为:" & mid(s,2)
s=s & vbcrlf & "最大值:" & m2 & " 最小值:" & m1
msgbox s