Ver Mensaje Individual
  #15  
Antiguo 17-11-2006
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Reputación: 24
seoane Va por buen camino
Si es que no nos fijamos

Código Delphi [-]
var
  last1,last2, aux:TBcd;
begin
  Last1:=StrToBcd('0');
  Last2:=StrToBcd('1');
  Aux  :=StrToBcd('0');
  while true do //jeje no queda agradable pero corto con el exit.. costumbre!
  begin
    BcdAdd(Last1,Last2,Aux); //sumo el f(x-1)+f(x-2) y lo meto en aux...
    Last1:= last2;
    Last2:=Aux;
    if Length(BcdToStr(Aux))= 21 then
    begin
      ShowMessage(BcdToStr(Last1));  // <--- Fijate bien
      Exit;
    end;
  end;
end;
Responder Con Cita