console.log("\tAlgoritmo calcula o fatorial de um número.\n");

function fatorial(numero) {

    if(numero == 0 || numero == 1)
        return 1;

    return numero * fatorial(numero - 1);
}

const num = 5;
const fatorialNum = fatorial(num);
console.log(`Fatorial de ${num} = ${fatorialNum}`);

Embed on website

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