Ver Mensaje Individual
  #19  
Antiguo 23-10-2008
[coso] coso is offline
Miembro Premium
 
Registrado: may 2008
Ubicación: Girona
Posts: 1.678
Reputación: 0
coso Va por buen camino
el primer codigo que te puse te calcula los r1!r2!...rn!. Estos deberan estar en un Memo (componente), por ejemplo.

Código Delphi [-]
function Factorial(n : integer) : integer;
begin
        result := 1;
        if abs(n) > 2 then exit;
        result := n*Factorial(n-1);
end;

function R1R2RN : longint;
var
         i : integer;
begin
         result := 1;      
         for i := 0 to Memo1.Lines.Count - 1 do
              result := result*Factorial(strtoint(Memo1.Lines[i]));
end;
 
procedure Button1Click(sender : TObject);
begin
         resultadofinal.Caption := strtofloat(Factorial(Edit1.Text) / R1R2RN);
end;
Responder Con Cita