From 0744c3190c20f0af9b0d2bd9c78d2e80c4585e27 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Wed, 5 Jan 2022 18:17:11 +0200 Subject: Create fact.cpp --- Sem. 12/fact.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Sem. 12/fact.cpp (limited to 'Sem. 12/fact.cpp') 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 + + + +unsigned factRec(unsigned n) // О(n) +{ + if (n == 0) + return 1; + return n * factRec(n - 1); +} + +int main() +{ + std::cout << factRec(5); + +} -- cgit v1.3.1-23-gd82d