Skip to content

Instantly share code, notes, and snippets.

@nerdybeast
Created November 6, 2016 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nerdybeast/3162adc4e9fe771a7a2e965842ab845a to your computer and use it in GitHub Desktop.
Save nerdybeast/3162adc4e9fe771a7a2e965842ab845a to your computer and use it in GitHub Desktop.
Euler 6 - Sum Square Difference
'use strict';
const MIN = 1;
const MAX = 100;
let sum = 0;
let sumOfSquares = 0;
for(var i = MIN; i <= MAX; i++) {
sum += i;
sumOfSquares += i*i;
}
let answer = (sum*sum) - sumOfSquares;
console.log('Sum of squares difference =>', answer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment