Created
April 7, 2017 13:34
-
-
Save maquinde/afe29a7355b293c1f4adc51ed4ea5fe0 to your computer and use it in GitHub Desktop.
Finds multiples of 3 and 5, then adds them together.
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
//Create variable to hold sum. | |
var num = 0; | |
//For loop to iterate through 1000. | |
for (var i = 0; i < 1000; i++){ | |
//Find multiples of 3 and 5. | |
if (i % 3 === 0 || i % 5 === 0){ | |
//Add them to num. | |
num += i; | |
} | |
} | |
console.log(num); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment