Hi i have to complete a program which do the following

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.

what this means ?

how to do it

i dont want yooou to do it but just give me hints


10 Years
Discussion Span
Last Post by manzoor

thing to do:
- find all the mutiples of 3 that are smaller then 1000
- find all the multiples of 5 that are smaller then 1000
- add all the number you've found
- done

You might want to look at the modules (%) operator for this assignment

Good luck!

Yeah! I've beat the Dragon to it

Edited by Nick Evan: n/a


Start by figuring out how to get the 3, 5, 6 and 9. If you know how to do that them its easy to find all those numbers below 1000. If you can't do it in your head then write it out with pencil & paper. Think about the process that is needed to get those numbers. Hint: use the mod operator % to determine if a number is evenly divisible by either 3 or 5 and a loop to test each number between 1 and 1000.

[edit]what Nick said too ^^^^^^^[/edit]

Edited by Nick Evan: n/a

Votes + Comments
Thanks hint

thanks yall

the problem is solved

the problem was that 15 is both a multiple of 3 and 5 so the program I had made sum 15 twice thats why my answer was incorrect thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.