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

thanks

3
Contributors
3
Replies
4
Views
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.

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

Edited by Nick Evan: n/a