Объяснение:
function factorial(n:integer):integer;
var
i, p:integer;
begin
p:=1;
for i:=1 to n do
p:=p*i;
factorial:=p;
end;
r, m:integer;
k:integer;
randomize;
r:=random(6);
writeln('r = ', r);
for k:=1 to r do begin
m:=random(6);
writeln(m, '! = ', factorial(m));
readln;
end.
Объяснение:
function factorial(n:integer):integer;
var
i, p:integer;
begin
p:=1;
for i:=1 to n do
p:=p*i;
factorial:=p;
end;
var
r, m:integer;
k:integer;
begin
randomize;
r:=random(6);
writeln('r = ', r);
for k:=1 to r do begin
m:=random(6);
writeln(m, '! = ', factorial(m));
end;
readln;
end.