Skip to content

Instantly share code, notes, and snippets.

@GedMullen
Last active November 4, 2015 12:35
Show Gist options
  • Save GedMullen/278f4ad58ee6e012e5b3 to your computer and use it in GitHub Desktop.
Save GedMullen/278f4ad58ee6e012e5b3 to your computer and use it in GitHub Desktop.
var i = 2;
function numberFunction(number) {
var sum = 0;
if(number<1){
console.log("Enter a positive whole number greater than 0");
}else{
for (count = number; count>0; count--) {
sum = sum + count;
if(count != 1){
process.stdout.write(count + "+");
}else{
process.stdout.write(count + "=");
}
}
console.log(sum);
}
}
for (i; i < process.argv.length; i++) {
numberFunction(Number(process.argv[i]));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment