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

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!


[edit]
Yeah! I've beat the Dragon to it

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]

commented: Thanks hint +1

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.