program FactorialSum;
function Factorial(num: integer): integer;vari, fact: integer;beginfact := 1;for i := 1 to num dofact := fact * i;Factorial := fact;end;
varn, i, sum: integer;beginsum := 0;
write('Enter a number: ');readln(n);
for i := 1 to n dosum := sum + Factorial(i);
writeln('Factorial sum: ', sum);
end.
program FactorialSum;
function Factorial(num: integer): integer;
var
i, fact: integer;
begin
fact := 1;
for i := 1 to num do
fact := fact * i;
Factorial := fact;
end;
var
n, i, sum: integer;
begin
sum := 0;
write('Enter a number: ');
readln(n);
for i := 1 to n do
sum := sum + Factorial(i);
writeln('Factorial sum: ', sum);
end.