FANDOM


Problem 1 Edit

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.

CodeEdit

new number sum 0
new number t
new number i 0
hereis loop
set #i #i + 1
set #t #i % 15
if #t = 0 a
set #t #i % 5
if #t = 0 a
set #t #i % 3
if #t = 0 a
hereis e
if #i = 999 end
goto loop
hereis a
set #sum #sum + #i
goto e
hereis end
write #sum