Skip to content

Instantly share code, notes, and snippets.

@rightfold
Created February 16, 2015 13:26
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 rightfold/17c9c5660759423c3557 to your computer and use it in GitHub Desktop.
Save rightfold/17c9c5660759423c3557 to your computer and use it in GitHub Desktop.
program hello;
function factorial(n: integer): integer;
begin
if (n < 2) then
factorial := 1
else
factorial := n * factorial(n - 1);
end;
var
n: integer;
begin
readln(n);
writeln(factorial(n))
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment