Skip to content

Instantly share code, notes, and snippets.

@meetKazuki
Created May 5, 2021 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meetKazuki/741caeb53758fa8641acf440e1b43d6b to your computer and use it in GitHub Desktop.
Save meetKazuki/741caeb53758fa8641acf440e1b43d6b to your computer and use it in GitHub Desktop.
A Pascal program that reads a positive integer N and tabulate the factorials of the number from 1 to N.
(*
WIP: This solution uses recursive factorial definition.
At the moment, this solution does not satisfy the complete requirements
of the problem statement. If I'm given enough time, I can implement a
solution that will match the specifications.
*)
program factorial;
function factorial(number: integer): longint;
begin
if (number = 0) then
factorial := 1
else
factorial := number * factorial(number - 1);
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment