solutions: 6
This commit is contained in:
parent
4b20b19146
commit
10a975e978
14
sum_square_difference.rs
Normal file
14
sum_square_difference.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
fn main() {
|
||||||
|
let mut total: u64 = 0;
|
||||||
|
let mut total1: u64 = 0;
|
||||||
|
|
||||||
|
for i in 1..=100 {
|
||||||
|
total += i*i;
|
||||||
|
total1 += i;
|
||||||
|
}
|
||||||
|
|
||||||
|
let square_sum = total1.pow(2);
|
||||||
|
let difference = square_sum-total;
|
||||||
|
|
||||||
|
println!("{}", difference);
|
||||||
|
}
|
Loading…
Reference in a new issue