Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Jonathan Hamada
4,810 PointsThe Final Countdown
I got stumped on this algorithm. How would I begin to code this function?
This is based on “Flexible Countdown”. The parameter names are not as helpful, but the problem is essentially identical; don’t be thrown off! Given 4 parameters (param1,param2,param3,param4), print the multiples of param1, starting at param2 and extending to param3. One exception: if a multiple is equal to param4, then skip (don’t print) that one. Do this using a WHILE loop.
Example: Given (3,5,17,9), print 6,12,15 (which are all of the multiples of 3 between 5 and 17, except for the value 9).
2 Answers

Steven Parker
225,712 PointsYou might start with your solution to the “Flexible Countdown”.
It says this problem is essentially identical to the “Flexible Countdown”. So you might start with the solution you wrote (or were shown) for that, and adjust the parameter names to fit.

Jonathan Hamada
4,810 PointsThanks buddy!

Jordany Rosas
Courses Plus Student 4,557 PointsYou might want to start by writing out your plan of attack.
Set a var i = p2 since that's what you want to start at.
while i <= param3 (Where you want your while loop to stop)
if i != param4 and i % param1 == 0 (doesn't include param4 and is a multiple of param1) console.log(i)
Don't forget to increment your i.
Also, this doesn't include edge cases.
Steven Parker
225,712 PointsSteven Parker
225,712 PointsPlease provide a link to the course page you are working with.