#include <iostream>
using namespace std;
int main() {
int numero;
unsigned long long factorial = 1;
cout << "Ingresa un número entero positivo: ";
cin >> numero;
if (numero < 0) {
cout << "El factorial no está definido para números negativos." << endl;
} else {
for (int i = 1; i <= numero; ++i) {
factorial *= i;
}
cout << "El factorial de " << numero << " es: " << factorial << endl;
}
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: