Created
November 6, 2016 19:44
-
-
Save nerdybeast/3162adc4e9fe771a7a2e965842ab845a to your computer and use it in GitHub Desktop.
Euler 6 - Sum Square Difference
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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