diff --git a/001/solution.rs b/001/solution.rs index 48100c0..0d65fb7 100644 --- a/001/solution.rs +++ b/001/solution.rs @@ -1,5 +1,18 @@ +// https://projecteuler.net/problem=1 fn main() { - println!("hello world"); + let mut sum = 0; + for n in 1..= 999 { + if n % 3 == 0 { + sum += n; + // println!("-- # {}", n); + } + + if n % 5 == 0 && n % 3 != 0 { + // println!("++ # {}", n); + sum += n; + } + } + println!("{}", sum); }