Skip to content

Instantly share code, notes, and snippets.

@mokyox
Last active March 7, 2017 19:12
Show Gist options
  • Save mokyox/8a9e5700a8fdbffd44b7a6547b98c926 to your computer and use it in GitHub Desktop.
Save mokyox/8a9e5700a8fdbffd44b7a6547b98c926 to your computer and use it in GitHub Desktop.
for (var i = 1; i <= 100; i++) {
  //If divisible by 3, print number and "Fizz"
  if (i % 3 == 0) {
    console.log( i + "Fizz");
  }
  
  //If divisible by 5, print number and "Buzz"
   else if (i % 5 == 0) {
      console.log( i + "Buzz")
                  }
                  
  //If divisble by both 3 and 5, print number and "FizzBuzz"
 if ((i % 3 == 0) && (i % 5 == 0)) {
   console.log(i + "FizzBuzz");
 }
 
else console.log(i); 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment