// Project Euler #1 Multiples of 3 or 5
// num is the maximum number e.g. 1000
// Iterative
fn solution(num: i32) -> i32 {
let mut sum = 0;
for i in 1 .. num {
if i % 3 == 0 || i % 5 == 0 {
sum += i;
}
}
sum
}
// Using filter
fn solution(num: i32) -> i32 {
(1..num).filter(|x| x % 3 == 0 || x % 5 == 0 ).sum()
}