Created
February 14, 2012 15:13
-
-
Save easierbycode/1827474 to your computer and use it in GitHub Desktop.
add 1-1000 excluding multiples of 5 and 7
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
// 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