Find factorial value

Posted in Mathematics

This example shows how to get factorial value for all numbers in [1, 30] interval

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
  Num: Real;
begin
  Num:=1;
  for i:=1 to 30 do
  begin
    Num:=Num*i;
    Memo1.Lines.Add(IntToStr(i)+'! = '+FloatToStr(Num));
  end;
end;