Sum multiples of 3 and 5: Difference between revisions
Content added Content deleted
(→{{header|Perl 6}}: add entry) |
(→{{header|BASIC}}: from history I see that perhaps a count was intended, not a sum) |
||
Line 3: | Line 3: | ||
== {{header|BASIC}} == |
== {{header|BASIC}} == |
||
{{works with|FreeBASIC}} |
{{works with|FreeBASIC}} |
||
{{incorrect||(Or if the function is right, the |
{{incorrect||(Or if the function is right, then the task description should say 'count of multiples of 3 or 5 no greater than a given number.' or some such...)}} |
||
<lang basic>Declare function mulsum35(n as integer) as integer |
<lang basic>Declare function mulsum35(n as integer) as integer |
||
Function mulsum35(n as integer) as integer |
Function mulsum35(n as integer) as integer |
||
Line 19: | Line 19: | ||
{{out}} |
{{out}} |
||
467 |
467 |
||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |
||
<lang perl6>sub sum35($n) { [+] grep * %% (3|5), ^$n; } |
<lang perl6>sub sum35($n) { [+] grep * %% (3|5), ^$n; } |