Sum multiples of 3 and 5: Difference between revisions
Content added Content deleted
(Added Chipmunk Basic, GW-BASIC, Minimal BASIC, MSX Basic and Quite BASIC) |
(Added Gambas) |
||
Line 503: | Line 503: | ||
90 multsum35 = suma |
90 multsum35 = suma |
||
100 end function</syntaxhighlight> |
100 end function</syntaxhighlight> |
||
==={{header|Gambas}}=== |
|||
<syntaxhighlight lang="vbnet">Public Sub Main() |
|||
Print "Sum of positive integers below 1000 divisible by 3 or 5 is : "; multSum35(999) |
|||
End |
|||
Function multSum35(n As Integer) As Integer |
|||
If n = 0 Then Return 0 |
|||
Dim suma As Integer = 0 |
|||
For i As Integer = 1 To n |
|||
If (i Mod 3 = 0) Or (i Mod 5 = 0) Then suma += i |
|||
Next |
|||
Return suma |
|||
End Function</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Same as FreeBASIC entry.</pre> |
|||
==={{header|GW-BASIC}}=== |
==={{header|GW-BASIC}}=== |