Sum multiples of 3 and 5: Difference between revisions
Content deleted Content added
Thundergnat (talk | contribs) m syntax highlighting fixup automation |
No edit summary |
||
Line 1,721: | Line 1,721: | ||
The sum of all the multiples of 3 or 5 below 1000 is 233168 |
The sum of all the multiples of 3 or 5 below 1000 is 233168 |
||
The sum of all multiples less than 1e20 is 2333333333333333333316666666666666666668 |
The sum of all multiples less than 1e20 is 2333333333333333333316666666666666666668 |
||
</pre> |
|||
=={{header|Futurebasic}}== |
|||
<syntaxhighlight lang="futurebasic"> |
|||
include "NSLog.incl" |
|||
_n = 1000 |
|||
void local fn DoIt |
|||
long i, sum = 0 |
|||
for i = 0 to _n - 1 |
|||
if ( i mod 3 == 0 or i mod 5 == 0 ) |
|||
sum += i |
|||
end if |
|||
next |
|||
NSLog(@"%ld",sum) |
|||
end fn |
|||
fn Doit |
|||
HandleEvents |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
233168 |
|||
</pre> |
</pre> |
||