19 lines
No EOL
457 B
Rust
19 lines
No EOL
457 B
Rust
pub fn sum_of_multiples(x: i64, factors: &Vec<i64>) -> i64 {
|
|
let mut sum: i64 = 0;
|
|
for i in factors{
|
|
print!("Factor: {}\n", i);
|
|
for j in 2..x{
|
|
print!("j: {}\n", j);
|
|
print!("mod: {0} % {1} = {2}\n", j, i, i%j);
|
|
if j % i == 0{
|
|
sum += j;
|
|
print!("Sum: {}\n", sum);
|
|
}
|
|
}
|
|
}
|
|
return sum;
|
|
}
|
|
|
|
pub fn main() {
|
|
sum_of_multiples(10, &vec![3,5]);
|
|
} |