求VB高手解答三道题目,急求!!!!!拜托各位大神!在线等!!!!
1)输出1到100之间的所有奇数。2)输出前20项fibonacci数列。(f1=1,f2=1,f(n)=f(n-1)+f(n-2)n>=3时)3)随机生成一个4*5矩阵...
1)输出1到100之间的所有奇数。
2)输出前20项fibonacci数列。(f1=1,f2=1,f(n)=f(n-1)+f(n-2) n>=3时)
3)随机生成一个4*5矩阵,找出其中的最小值及其行标和列标。 展开
2)输出前20项fibonacci数列。(f1=1,f2=1,f(n)=f(n-1)+f(n-2) n>=3时)
3)随机生成一个4*5矩阵,找出其中的最小值及其行标和列标。 展开
4个回答
展开全部
奇数:
Private Sub Command1_Click()
For i = 1 To 99 Step 2
Print i
Next i
End Sub
fibonacci数列:
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer
a = 1: b = 1
Print a; b;
For i = 3 To 20
c = a + b
Print c;
a = b: b = c
Next i
End Sub
4*5矩阵:
Option Base 1
Private Sub Command1_Click()
Dim a(4, 5) As Integer
For i = 1 To 4
For j = 1 To 5
a(i, j) = Int(Rnd * 100 + 1)
Print a(i, j);
Next j
Print
Next i
Min = 101
For i = 1 To 4
For j = 1 To 5
If a(i, j) < Min Then Min = a(i, j)
Next j
Next i
For i = 1 To 4
For j = 1 To 5
If a(i, j) = Min Then Print "最小值:"; a(i, j), "第"; i; "行"; "第"; j; "列"
Next j
Next i
End Sub
Private Sub Command1_Click()
For i = 1 To 99 Step 2
Print i
Next i
End Sub
fibonacci数列:
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer
a = 1: b = 1
Print a; b;
For i = 3 To 20
c = a + b
Print c;
a = b: b = c
Next i
End Sub
4*5矩阵:
Option Base 1
Private Sub Command1_Click()
Dim a(4, 5) As Integer
For i = 1 To 4
For j = 1 To 5
a(i, j) = Int(Rnd * 100 + 1)
Print a(i, j);
Next j
Next i
Min = 101
For i = 1 To 4
For j = 1 To 5
If a(i, j) < Min Then Min = a(i, j)
Next j
Next i
For i = 1 To 4
For j = 1 To 5
If a(i, j) = Min Then Print "最小值:"; a(i, j), "第"; i; "行"; "第"; j; "列"
Next j
Next i
End Sub
展开全部
求奇数
private sub comand1_click ()
i=0
do
i=i+1
if imod2 <>2 then
print i
end if
end sub
fibonacci数列
private sub command1_click ()
dim f(1 to 20)
f(1)=1
f(2)=1
i=2
do
i=i+1
f(i)=f(i-1)+f(i-2)
loop until i=20
i=0
do
i=i+1
print f(i)
loop until i=20
end sub
矩阵
dim a(1 to 4,1 to 5)
i=0
j=0
do
i=i+1
do
j=j+1
a(i,j)=int(100*rnd+1)
loop until j=5
loop until i=4
不好意思啊,矩阵忘记怎么整了,希望对您有所帮助
private sub comand1_click ()
i=0
do
i=i+1
if imod2 <>2 then
print i
end if
end sub
fibonacci数列
private sub command1_click ()
dim f(1 to 20)
f(1)=1
f(2)=1
i=2
do
i=i+1
f(i)=f(i-1)+f(i-2)
loop until i=20
i=0
do
i=i+1
print f(i)
loop until i=20
end sub
矩阵
dim a(1 to 4,1 to 5)
i=0
j=0
do
i=i+1
do
j=j+1
a(i,j)=int(100*rnd+1)
loop until j=5
loop until i=4
不好意思啊,矩阵忘记怎么整了,希望对您有所帮助
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询