Skip to content

Instantly share code, notes, and snippets.

@easierbycode
Created February 14, 2012 15:13
Show Gist options
  • Save easierbycode/1827474 to your computer and use it in GitHub Desktop.
Save easierbycode/1827474 to your computer and use it in GitHub Desktop.
add 1-1000 excluding multiples of 5 and 7
// coderbyte.com intro challenge
function jsChallenge() {
var num = 0;
for(i=0; i<=1000; i++) {
if( !(isMultipleOfFive(i) || isMultipleOfSeven(i)) ) {
num += i;
}
}
return num;
function isMultipleOfFive(n) {
return n % 5 === 0;
}
function isMultipleOfSeven(n) {
return n % 7 === 0;
}
}
jsChallenge();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment