#include <iostream>

int factorial(int n) {
    if (n == 0) {
        return 1;
    } else {
        return n * factorial(n-1);
    }
}

int main() {
    int num;
    std::cout << "Ingrese un número: ";
    std::cin >> num;
    std::cout << "La factorial es: " << factorial(num) << std::endl;
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: