From 1c79cff86e5cfae48e00184842101a9678b89903 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 5 Jan 2021 10:59:51 +0100 Subject: Lots of work, refactoring. --- factorial.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 factorial.hpp (limited to 'factorial.hpp') 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); + } +} -- cgit v1.2.3-54-g00ecf