Skip to content

Commit 49c940e

Browse files
Alexander WormuthAlexander Wormuth
authored andcommitted
added multiples_of_3_and_5 in go
1 parent 882674b commit 49c940e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
Multiples of 3 and 5
3+
This program sums up all the multiples of 3 and 5 under 1000.
4+
*/
5+
6+
package main
7+
8+
import "fmt"
9+
10+
func main() {
11+
sum := 0
12+
13+
for i := 0; i < 1000; i++ {
14+
if i % 3 == 0 || i % 5 == 0 {
15+
sum += i
16+
}
17+
}
18+
19+
fmt.Println(sum)
20+
}
21+
22+

0 commit comments

Comments
 (0)