Skip to content

Instantly share code, notes, and snippets.

@MuddyBootsCode
Created April 27, 2022 14:26
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 MuddyBootsCode/5537f05085ae234a8984bac4e51f22d2 to your computer and use it in GitHub Desktop.
Save MuddyBootsCode/5537f05085ae234a8984bac4e51f22d2 to your computer and use it in GitHub Desktop.
function sumSquareDifference(n) {
let sum = 0;
let square = 0;
for(let i = 1; i <= n; i++){
sum += i ** 2;
square += i;
}
return (square ** 2 - sum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment