Skip to content

Instantly share code, notes, and snippets.

@blessochampion
Created March 19, 2018 14:26
Show Gist options
  • Save blessochampion/2fafd36d8213e1e91910e04940d3543d to your computer and use it in GitHub Desktop.
Save blessochampion/2fafd36d8213e1e91910e04940d3543d to your computer and use it in GitHub Desktop.
Calculate the sum of Squares of the first N natural numbers.
function squareSumOfNaturalNumbers(n) {
var sum = 0;
for (var i = 1; i <= n; i++) {
sum += i*i;
}
return sum;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment