Im far or near to get the exercise? Exercise 18.3 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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); } }

7th Apr 2021, 10:04 PM
Jorge Vasquez
Jorge Vasquez - avatar
1 Answer
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);
8th Apr 2021, 11:17 AM
Ipang