This commit is contained in:
Honor 2024-12-02 10:13:02 +04:00
parent 3af0108e80
commit f02e4d1c5d

12
1.cpp
View File

@ -1 +1,11 @@
include
#include <iostream>
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;
}