You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
// https://projecteuler.net/problem=1
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|