uses Unit1;
{$R *.dfm}
function Factorial(n : integer) : LongWord;
begin
result := 1;
if (n = 1)or(n = 0) then exit;
result := n*Factorial(n-1);
end;
procedure TFormClasif1.btnCalcularFac1Click(Sender: TObject);
var
n, n2, factorial, factorial2, i, i2, acumulador:integer;
RS:double;
begin
n:=strtoint(edit1.Text);
n2:=strtoint(edrs.Text);
acumulador := 1;
factorial := 1;
factorial2 := 1;
for i:=1 to n do
factorial := factorial*i;
ResN.Caption := inttostr(factorial);
for i2 :=1 to n2 do
factorial2 := factorial2*i2;
acumulador := acumulador*factorial2;
factR.Caption:=inttostr(acumulador);
RS := factorial/factorial2;
resultadoFinal.Caption := FormatFloat('0.000000000',RS);
end;