Created
October 2, 2014 05:33
-
-
Save ian128K/6b868166d4b4796f162b to your computer and use it in GitHub Desktop.
Function for adding all numbers from 1 to a given number
This file contains 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 addFromOneToNum(num) { | |
var output; | |
output = num; | |
for(var i = 1; i < num; i++) { | |
output += i; | |
} | |
return output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment