Browse Source

006 ok (previous was not ok, sorry i lied)

master
Coin de Gamma 1 year ago
parent
commit
f80d51119b
  1. 4
      006/solution.rs

4
006/solution.rs

@ -3,7 +3,7 @@ fn main() {
// SOLUTION 1
let mut sum_1 = 0;
let mut sum_a = 0;
for i in 0..100 {
for i in 0..=100 {
sum_1 += i;
sum_a += i * i;
}
@ -15,7 +15,7 @@ fn main() {
{
// SOLUTION 2
let n = 99;
let n = 100;
let solution_2 = ( (n * (n + 1) ) / 2) * ( (n * (n + 1) ) / 2 ) - ( (n * (n + 1) * (2 * n + 1)) / 6 );
println!("solution2: {}", solution_2);
}

Loading…
Cancel
Save