954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

what it means ?

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

manzoor
Junior Poster in Training
54 posts since Nov 2007
Reputation Points: 12
Solved Threads: 3
 

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

Nick Evan
Not a Llama
Moderator
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
 

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]

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

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

manzoor
Junior Poster in Training
54 posts since Nov 2007
Reputation Points: 12
Solved Threads: 3
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You