Problem description:

http://projecteuler.net/index.php?section=problems&id=1

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.



My solution:


The logic behind:

Simply put: Iterate over all numbers between 0 and 1000, and check if the given number is a multiple of  3 or 5. If the number does satisfy this requirement, add it to the stack.

Solution (PHP):
<?php

Echo "To be continued:)";
?>
Answer
233168

Leave a Reply

You must be logged in to post a comment.