Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 12 / fact.cpp
diff options
context:
space:
mode:
Commit0744c3190c20f0af9b0d2bd9c78d2e80c4585e27 (patch)
Author
 Angel Dimitriev <achi_d@abv.bg>
2022-01-05 18:17:11 +0200
Committer
 GitHub <noreply@github.com>
2022-01-05 18:17:11 +0200
Files5294ee4fefe30e317966a7d9f8f6ad0caa65adb7 /Sem. 12/fact.cpp
Introduction_to_programming_FMI-0744c3190c20f0af9b0d2bd9c78d2e80c4585e27.tar
Introduction_to_programming_FMI-0744c3190c20f0af9b0d2bd9c78d2e80c4585e27.tar.gz
Introduction_to_programming_FMI-0744c3190c20f0af9b0d2bd9c78d2e80c4585e27.zip
Parent2ea5adf2bb1559b06854ffd0db508eed0d21c274 (diff)
Create fact.cpp
1 files changed, 16 insertions, 0 deletions
-rw-r--r--Sem. 12/fact.cpp16
diff --git a/Sem. 12/fact.cpp b/Sem. 12/fact.cpp
new file mode 100644
index 0000000..bd97a5e
--- /dev/null
+++ b/Sem. 12/fact.cpp
@@ -0,0 +1,16 @@
+#include <iostream>
+
+
+
+unsigned factRec(unsigned n) // О(n)
+{
+ if (n == 0)
+ return 1;
+ return n * factRec(n - 1);
+}
+
+int main()
+{
+ std::cout << factRec(5);
+
+}