vb编成实现求斐波拉契数列(1,1,2,3,5,8,13,21,34,)前n项的和
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/10 22:43:33
vb编成实现求斐波拉契数列(1,1,2,3,5,8,13,21,34,)前n项的和
Option Explicit
Function f(n As Integer) As Long
If n = 1 Then
f = 1
ElseIf n = 2 Then
f = 1
Else
f = f(n - 2) + f(n - 1)
End If
End Function
Sub command1_click()
Dim n As Integer
Dim s As Long
Dim i As Integer
n = InputBox("")
For i = 1 To n
s = s + f(i)
Next
Print s
End Su
Function f(n As Integer) As Long
If n = 1 Then
f = 1
ElseIf n = 2 Then
f = 1
Else
f = f(n - 2) + f(n - 1)
End If
End Function
Sub command1_click()
Dim n As Integer
Dim s As Long
Dim i As Integer
n = InputBox("")
For i = 1 To n
s = s + f(i)
Next
Print s
End Su
vb编成实现求斐波拉契数列(1,1,2,3,5,8,13,21,34,)前n项的和
有一数列:1、1、2、3、5、8、13、21……写一个过程以求出这个数列的前100项之和 VB求写个程序
用while…Wend语句完成求数列1,1,2,3,5,8,13,21,33……的前20项之和.中的求数列和,在VB程序
vb编程 在窗体上打印数列2/1,3/2,5/3,8/5,13/8…的前10项,并求其和.
vb编程题,1、* 编写程序,计算并输出下面数列中前n项的和.(设n=20)1*2*3,2*3*4,3*4*5,……,n
求该数列第n项的表示和前n项的和:1,1,2,3,5,8,13,21,34,55……
用VB求数列1,2,3,5,16,231.的前20项
vb编程 用递归函数求数列1,1,2,3,5,8,13,21.的第N项
已知数列an的前n项和Sn=3n^2+5n 数列bn中 b1=8 b(n-1)=64bn
已知an=5n(n+1)(n+2)(n+3),求数列{an}的前n项和Sn
求数列的前n项和1/2,3/4,5/8,…,2n-1/2^n,…
试求数列1/2,3/4,5/8,7/16.的前n项和