Coin de Gamma
2 years ago
1 changed files with 14 additions and 1 deletions
@ -1,5 +1,18 @@ |
|||||||
|
// https://projecteuler.net/problem=1
|
||||||
|
|
||||||
fn main() { |
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); |
||||||
} |
} |
||||||
|
|
||||||
|
Loading…
Reference in new issue