早教吧 育儿知识 作业答案 考试题库 百科 知识分享

随机产生10个[30,100]内的整数,求最小值及所对应的下标.

题目详情
随机产生10个[30,100]内的整数,求最小值及所对应的下标.
▼优质解答
答案和解析
dim a(70) as integer,a as integer,kk as integer
for i=0 to 70
Randomize
a(i)=Int(Rand()*71)+30
next
a=a(0)
for i=1 to70
if a>a(i) then
a=a(i)
kk=i
end if
next
msgbox "最小值是" & a & "; 下标是" & Kk