
Patrick B. answered 07/12/19
Math and computer tutor/teacher
program MathCalculation (input,output);
{***********************************************************}
Function Factorial ( n : integer) : longint;
Begin
if (n=1) or (n=0) then
Factorial := 1
else
if (n=2) then
Factorial:=2
else Factorial := n * Factorial(n-1);
end;
{***********************************************************}
Var
N : integer;
{***********************************************************}
Begin
repeat
write(' Please input N :>');
readln(N);
until (N>=0);
writeln( Factorial(N));
End.