用delphi Fibonacci数列,前几个数为0,1,1,2,3,5,…,其规律是:F1=0 (n=1) F2=1 (n=2) Fn=Fn-1Fibonacci数列,前几个数为0,1,1,2,3,5,…,其规律是:\x05\x05F1=0 (n=1)\x05\x05F2=1 (n=2)\x05\x05Fn=Fn-1+Fn-2 (n≥3)\x0
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/28 08:46:50
用delphi Fibonacci数列,前几个数为0,1,1,2,3,5,…,其规律是:F1=0 (n=1) F2=1 (n=2) Fn=Fn-1Fibonacci数列,前几个数为0,1,1,2,3,5,…,其规律是:\x05\x05F1=0 (n=1)\x05\x05F2=1 (n=2)\x05\x05Fn=Fn-1+Fn-2 (n≥3)\x0
用delphi Fibonacci数列,前几个数为0,1,1,2,3,5,…,其规律是:F1=0 (n=1) F2=1 (n=2) Fn=Fn-1
Fibonacci数列,前几个数为0,1,1,2,3,5,…,其规律是:
\x05\x05F1=0 (n=1)
\x05\x05F2=1 (n=2)
\x05\x05Fn=Fn-1+Fn-2 (n≥3)
\x05编程序求此数列的前40个数.
用delphi Fibonacci数列,前几个数为0,1,1,2,3,5,…,其规律是:F1=0 (n=1) F2=1 (n=2) Fn=Fn-1Fibonacci数列,前几个数为0,1,1,2,3,5,…,其规律是:\x05\x05F1=0 (n=1)\x05\x05F2=1 (n=2)\x05\x05Fn=Fn-1+Fn-2 (n≥3)\x0
function TForm1.getFibo:string;
var
a:array [0..40] of integer;
i:integer;
begin
Result := '0 1';
a[0] := 0;
a[1] := 1;
for i:=2 to 40 do
begin
a[i] := a[i-1]+a[i-2];
Result := Result + ' ' + IntToStr(a[i]);
end;
end;
procedure TForm1.btn1Click(Sender:TObject);
begin
ShowMessage(getFibo);
end;