r/codehs • u/Beeg_boi8 • Sep 07 '23
JavaScript Help! JavaScript 4.8.5 Factorials
I’m stuck on 4.8.5, I have it where I outputs the correct factorial but I need it to print out the whole equation. For example, if my number is 5 it should be 5 * 4 * 3 * 2 * 1 = 120. And it has to work for ANY number inputted
5
Upvotes
View all comments
Show parent comment
1
u/5oco Sep 07 '23
So like... just print statements?
Before the loop print (N + "! = " + N)
Inside the loop print, ( " * " + i)
Outside the loop print, (" = " + sum)
Something like that should print it