Skip to content

Instantly share code, notes, and snippets.

@musoftware
Created February 16, 2014 07:50
Show Gist options
  • Save musoftware/9030842 to your computer and use it in GitHub Desktop.
Save musoftware/9030842 to your computer and use it in GitHub Desktop.
Sum square difference
function result() {
var i = 0;
var i2 = 0;
for (var z = 1; z <= 100; z++) {
i += z;
i2 += Math.pow(z, 2);
}
return Math.pow(i, 2) - i2;
}
document.write(result());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment