Created
March 19, 2018 14:19
-
-
Save blessochampion/668d53801b4914befc571be3d4647eff to your computer and use it in GitHub Desktop.
Sum of Natural Numbers
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
function sumOfNaturalNumbers(n) { | |
var sum = 0; | |
for (var i = 1; i <= n; i++) { | |
sum += i; | |
} | |
return sum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment