用VB打印斐波那契数列的前N项,要求在文本框中给出n的值,当n大于20时提示重新输入信息,结果显示列表框 Private Function F(N As Long)As LongIf N>;2 ThenF=F(N-1)+F(N-2)ElseF=1End IfEnd FunctionPrivate Sub Command1_Click()ClsDim N As Long,I As Long,sum As Longsum=0N=Val(Text1.Text)if n>;20 thenmsgbox\"请重新输入exit functionend ifFor I=1 To Nprint F(I)Next IEnd Sub

vb程序 斐波那契数列的第一项是0,第二项是1,以后各项都是前两的和,编写程序,求斐波那契数列第N项的值 Private Sub Command1_Click()n=Val(InputBox(\"输入抄N的值百\",\"求斐波那契数列度第N项的值\"))ReDim a(n)a(1)=0:a(2)=1For i=3 To na(i)=a(i-1)+a(i-2)NextPrint\"第;n;项的值是:;a(n)End Sub

求VB利用递归法编写函数,求斐波那契数列的第n项值并在调用函数的过程中输出结果 是一个VB编程题 希望你能够给力!谢谢 窗体中放入Text控件和命令按钮。.