2/1+3/2+5/3+8/5+13/8+21/13的前10项之和
答案:2 悬赏:0 手机版
解决时间 2021-02-08 05:42
- 提问者网友:辞取
- 2021-02-07 16:28
2/1+3/2+5/3+8/5+13/8+21/13的前10项之和
最佳答案
- 五星知识达人网友:醉吻情书
- 2021-02-07 16:55
Private Sub Command1_Click()
Dim i As Integer, dbl1 As Double, d1(1 To 20) As Double, d2(1 To 20) As Double
d1(1) = 2: d1(2) = 3: d2(1) = 1: d2(2) = d1(1)
For i = 3 To 20
d1(i) = d1(i - 1) + d1(i - 2)
d2(i) = d1(i - 1)
Next i
For i = 1 To 20
dbl1 = dbl1 + d1(i) / d2(i)
Next i
Print dbl1
End Sub
ps: 32.6602607986416
Dim i As Integer, dbl1 As Double, d1(1 To 20) As Double, d2(1 To 20) As Double
d1(1) = 2: d1(2) = 3: d2(1) = 1: d2(2) = d1(1)
For i = 3 To 20
d1(i) = d1(i - 1) + d1(i - 2)
d2(i) = d1(i - 1)
Next i
For i = 1 To 20
dbl1 = dbl1 + d1(i) / d2(i)
Next i
Print dbl1
End Sub
ps: 32.6602607986416
全部回答
- 1楼网友:詩光轨車
- 2021-02-07 18:23
a=1.0
b=2.0
sum=0.0
c=0.0
for i in range(0,50):
sum= sum+ b/a
c= a+b
a= b
b= c
print sum
我主要是写java,也是刚开始学习python
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯