Sum multiples of 3 and 5: Difference between revisions

→‎{{header|Lasso}}: adding Lasso multiples of 3 & 5 calculation
m (→‎version 3: added a REXX section header comment about the formula used. -- ~~~~)
(→‎{{header|Lasso}}: adding Lasso multiples of 3 & 5 calculation)
Line 530:
{{out}}
<pre>233168</pre>
 
 
 
=={{header|Lasso}}==
<lang Lasso>local(limit = 1)
while(#limit <= 100000) => {^
local(s = 0)
loop(-from=3,-to=#limit-1) => {
not (loop_count % 3) || not (loop_count % 5) ? #s += loop_count
}
'The sum of multiples of 3 or 5 between 1 and '+(#limit-1)+' is: '+#s+'\r'
#limit = integer(#limit->asString + '0')
^}</lang>
{{out}}
<pre>The sum of multiples of 3 or 5 between 1 and 0 is: 0
The sum of multiples of 3 or 5 between 1 and 9 is: 23
The sum of multiples of 3 or 5 between 1 and 99 is: 2318
The sum of multiples of 3 or 5 between 1 and 999 is: 233168
The sum of multiples of 3 or 5 between 1 and 9999 is: 23331668
The sum of multiples of 3 or 5 between 1 and 99999 is: 2333316668</pre>
 
=={{header|Mathematica}}==
140

edits