re: Project Euler #6 - Sum Square Difference VIEW POST

FULL DISCUSSION
 

Rust

fn get_sum_square_difference(end: usize) -> usize {
    let mut sum: usize = 0;
    let square_sum = (1..=end).fold(0usize, |fin, num| { sum += num; fin + num.pow(2) });

    sum.pow(2) - square_sum
}
code of conduct - report abuse