I just found this cool new website which has a bunch of interesting math/computer programming related problems. Heres my go at the first problem using Processing. It was quite trivial to solve in the inefficient way I did but some of the problems ahead are pretty intense!
Problem 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."
Here is the code:
for ( int i = 0; i<1000 code="code" i="i">1000> |
if (i%3 == 0 || i%5 == 0) { |
No comments:
Post a Comment