# Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Euler #1

• This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
• Author
Posts
• #185813
GSG
Participant

http://codepen.io/gsg/pen/fLkyF

Problem:

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

I verified manually for <10 and <100 and in both cases the answer is right. What’s wrong with this code?

#185814
__
Participant

@GSG

# please DO NOT post pens that use `alert`.

### please edit your pen and remove the `alert` function.

.

Beyond that, I’m not sure I follow your question. However, you say:

Find the sum of all the multiples of 3 or 5 below 1000.

but your code seems to find the sum of all natural numbers below 1000 multiplied by 3 where the product is below 1000, and multiplied by 5 where the product is below 1000. I don’t know if this is a problem with the way you’re writing the code, or the way you’re reading the question.

In either case, this sounds like a homework questionâ€¦? We’re not here to do homework for you. If there’s a specific question you’re asking, I’d be happy to help.

#185894
GSG
Participant