Coin de Gamma
2 years ago
1 changed files with 9 additions and 12 deletions
@ -1,18 +1,15 @@ |
|||||||
// https://projecteuler.net/problem=1
|
// https://projecteuler.net/problem=1
|
||||||
|
|
||||||
fn main() { |
fn main() { |
||||||
let mut sum = 0; |
let mut sum = 0; |
||||||
for n in 1..= 999 { |
for n in 1..= 999 { |
||||||
if n % 3 == 0 { |
if n % 3 == 0 { |
||||||
sum += n; |
sum += n; |
||||||
// println!("-- # {}", n);
|
} |
||||||
} |
if n % 5 == 0 && n % 3 != 0 { |
||||||
|
sum += n; |
||||||
if n % 5 == 0 && n % 3 != 0 { |
|
||||||
// println!("++ # {}", n);
|
|
||||||
sum += n; |
|
||||||
} |
|
||||||
} |
} |
||||||
println!("{}", sum); |
} |
||||||
|
println!("{}", sum); |
||||||
} |
} |
||||||
|
|
||||||
|
Loading…
Reference in new issue