(1) 42 (2)11 17 (3) 1.5 2
(1)a.最小公倍数
private sub command1_click()
dim m%,n%,r%,t%
m=inputbox("输入m=")
n=inputbox("输入n=")
x=m:y=n
if m<n then t =m:m=n"n=t
do
r=m mod n
m=n
n=r
loop while r<>0 ' 最大公约数为 m
msgbox "最小公倍数为:" & x*y/m ' 最小公倍数= m*n/ m
b. private sub command1_click()
dim a!,b!,c! ,p! ,s&
a=val(text1.text)
b=val(text2.text)
c=val(text2.text)
p=(a+b+c)/2 '周长的一半
s=sqr(p*(p-a)*(p-b)*(p-c)) '海伦定理
msgbox "面积是"& s
(2).a.
dim a%(1 to 100)
randomize
for i = 1 to 100
x=int(rnd*1000)
a(i)=x
next
b.
sub sub1(a())
dim t%,i%
for i =1 to 50
t=a(i)
a(i)=a(100-i+1)
a(100-i+1)=t
next i
end sub
c. for i =1 to 100
print a(i),
if i mod 5=0 then print
next
(3) private sub command1_click()
dim a %(50) ,k%,min %
for i=1 to 50
x=int(rnd*50)
a(i)=x
next
min=a(1)
for i=2 to 50
if min>a(i) then min=a(i):k=i
next
print "最小数为:"min
pirnt "位置是:"k
end sub
1: A2:BCD
3:B
4:ABC
5:ABCDE
6:ABD
7:ACD
8:AD
9:AC
10:BCD
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)