From 9adb307ea17a8e3a3834b0caf7b92843d2a6ab13 Mon Sep 17 00:00:00 2001 From: Honor Date: Mon, 16 Dec 2024 09:13:57 +0400 Subject: [PATCH] cv --- 1.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/1.cpp b/1.cpp index e69de29..69b73b3 100644 --- a/1.cpp +++ b/1.cpp @@ -0,0 +1,11 @@ +#include +int factorial(int n) { + return (n == 1 || n == 0) ? 1 : n * factorial(n - 1); +} +int main() { + int num; + std::cout << "Enter a number: "; + std::cin >> num; + std::cout << "Factorial: " << factorial(num) << std::endl; + return 0; +}