0
Im far or near to get the exercise? Exercise 18.3
function main() { var number = parseInt(readLine(), 10) var factorial = 1; // Tu código va aqui for (x = factorial * number; factorial <= number; factorial++){ console.log(number); } }
1 Réponse
0
You are supposed to multiply <factorial> with each number in a sequence beginning with 1 and ending at <number>. And display final value of <factorial> in the end, not <number>.
for (let x = 1; x <= number; x++)
{
factorial *= x;
}
console.log(factorial);