18 lines
282 B
Coq
18 lines
282 B
Coq
|
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)
|
||
|
}
|