Sum multiples of 3 and 5: Difference between revisions
Content added Content deleted
(→{{header|Simula}}: Number found to SYSOUT) |
m (→{{header|Go}}) |
||
Line 1,132: | Line 1,132: | ||
func s35(n int) int { |
func s35(n int) int { |
||
n-- |
n-- |
||
threes := |
threes := n / 3 |
||
fives := |
fives := n / 5 |
||
fifteen := |
fifteen := n / 15 |
||
⚫ | |||
threes = 3 * threes * (threes + 1) |
|||
fives = 5 * fives * (fives + 1) |
|||
fifteen = 15 * fifteen * (fifteen + 1) |
|||
⚫ | |||
return n |
|||
}</lang> |
}</lang> |
||
{{out}} |
{{out}} |