Sub 斐波那契()
Dim m,n,t As Integer
Dim a(20) As Integer
a(1) = 1
a(2) = 1
n = 1
For m = 3 To 20
a(m) = a(m - 1) + a(m - 2)
t = m Mod 2
If t = 1 Then
n = n + a(m)
End If
Next
MsgBox ("斐波那数列前20项奇数项之和为" & n)
End Su
Sub 斐波那契()
Dim m,n,t As Integer
Dim a(20) As Integer
a(1) = 1
a(2) = 1
n = 1
For m = 3 To 20
a(m) = a(m - 1) + a(m - 2)
t = m Mod 2
If t = 1 Then
n = n + a(m)
End If
Next
MsgBox ("斐波那数列前20项奇数项之和为" & n)
End Su