From bd940865c8e47e41d3c513275202a39205274db2 Mon Sep 17 00:00:00 2001 From: Coin de Gamma Date: Sat, 25 Feb 2023 11:28:04 +0000 Subject: [PATCH] 001-ok --- 001/solution.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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); }