Skip to content

Instantly share code, notes, and snippets.

@maquinde
Created April 7, 2017 13:34
Show Gist options
  • Save maquinde/afe29a7355b293c1f4adc51ed4ea5fe0 to your computer and use it in GitHub Desktop.
Save maquinde/afe29a7355b293c1f4adc51ed4ea5fe0 to your computer and use it in GitHub Desktop.
Finds multiples of 3 and 5, then adds them together.
//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