summaryrefslogtreecommitdiff
path: root/factorial.hpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2024-04-02 17:24:14 +0200
committerJaron Kent-Dobias <jaron@kent-dobias.com>2024-04-02 17:24:14 +0200
commit92c319247fae9d8be3f3291d6fa64266224ef61c (patch)
tree58c6a23c5117310ca18fda3c3813516271b6f343 /factorial.hpp
parenta0d936b498735569c6570b020b47d0430883406b (diff)
downloadcode-92c319247fae9d8be3f3291d6fa64266224ef61c.tar.gz
code-92c319247fae9d8be3f3291d6fa64266224ef61c.tar.bz2
code-92c319247fae9d8be3f3291d6fa64266224ef61c.zip
Added tensor support.
Diffstat (limited to 'factorial.hpp')
-rw-r--r--factorial.hpp9
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);
+ }
+}