Skip to content

Commit c748e24

Browse files
authored
Merge pull request #707 from awormuth/master
added multiples_of_3_and_5 in go
2 parents 3cc5a27 + 49c940e commit c748e24

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)