Fakultät in Lazarus (Pascal) berechnen?

1 Antwort

Vom Fragesteller als hilfreich ausgezeichnet

Naja, so kompliziert ist das nicht, 5! = 1*2*3*4*5 ...

function fak(x:integer):integer;
var res, i: integer;
begin
  res:= 1;
  for i:=2 to x do res := res * i;
  fak:=res;
end;
Woher ich das weiß:Studium / Ausbildung – Informatiker