euler/rust/src/euler/problem_001.rs

14 lines
240 B
Rust
Raw Normal View History

2019-10-07 02:47:01 +00:00
pub fn solution() -> i32 {
(1..1000).filter( |n| (n % 3 == 0) || (n % 5 == 0)).sum()
2018-09-20 10:38:09 +00:00
}
#[cfg(test)]
mod tests {
use euler::problem_001::solution;
#[test]
fn problem_001() {
2019-10-07 02:47:01 +00:00
assert_eq!(solution(), 233_168);
2018-09-20 10:38:09 +00:00
}
}