diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2021-01-05 10:59:51 +0100 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2021-01-05 10:59:51 +0100 |
commit | 1c79cff86e5cfae48e00184842101a9678b89903 (patch) | |
tree | 02cdd0dc28542127a3276024f141869bd5404af7 /factorial.hpp | |
parent | 85d168276c10a42c16283bacc61391b82b9ee399 (diff) | |
download | code-1c79cff86e5cfae48e00184842101a9678b89903.tar.gz code-1c79cff86e5cfae48e00184842101a9678b89903.tar.bz2 code-1c79cff86e5cfae48e00184842101a9678b89903.zip |
Lots of work, refactoring.
Diffstat (limited to 'factorial.hpp')
-rw-r--r-- | factorial.hpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/factorial.hpp b/factorial.hpp new file mode 100644 index 0000000..ddc0bac --- /dev/null +++ b/factorial.hpp @@ -0,0 +1,9 @@ +#pragma once + +long unsigned factorial(unsigned p) { + if (p == 0) { + return 1; + } else { + return p * factorial(p - 1); + } +} |