Faktoriál - funkcia

program factorial;

uses crt;

var x,k:longint;

function fact(a:longint):longint;

var c,i:longint;

BEGIN

c:=1;

for i:=1 to a do c:=c*i;

fact:=c;

end;

BEGIN

writeln ('Zadaj cislo');

readln (x);

writeln (fact(x));

readln;

END.