euler/v/euler001.v

18 lines
282 B
Coq
Raw Normal View History

2020-01-08 11:06:42 +00:00
fn multiples_of_three_and_five_below(n int) []int {
mut nums := []int
for i := 3; i < n; i++ {
if i % 3 == 0 || i % 5 == 0 {
nums << i
}
}
return nums
}
fn main() {
mut result := 0
for n in multiples_of_three_and_five_below(1000) {
result += n
}
println(result)
}