Sum multiples of 3 and 5: Difference between revisions

(→‎{{header|APL}}: added output)
Line 617:
0 milliseconds with rexx m35a > m35a.txt
46 millisecond with rexx m35a</pre>
 
=={{header|Run BASIC}}==
<lang runbasic>print multSum35(1000)
end
function multSum35(n)
for i = 1 to n - 1
If (i mod 3 = 0) or (i mod 5 = 0) then multSum35 = multSum35 + i
next i
end function</lang><pee>233168</pee>
 
=={{header|Scala}}==
<lang scala>def sum35( max:BigInt ) : BigInt = max match {
<math>Insert formula here</math>
 
// Simplest solution but limited to Ints only
case j if j < 100000 => (1 until j.toInt).filter( i => i % 3 == 0 || i % 5 == 0 ).sum
Anonymous user