Skip to content

Instantly share code, notes, and snippets.

@antimatter15
Created August 24, 2016 13:25
Show Gist options
  • Save antimatter15/0c4c35a2b3bcba53fd7f0c6a20476fc8 to your computer and use it in GitHub Desktop.
Save antimatter15/0c4c35a2b3bcba53fd7f0c6a20476fc8 to your computer and use it in GitHub Desktop.
Fizz Buzz
var str = "" ///Write a program that prints the numbers from 1 to 100. \\\\But for multiples of three print "_Fizz_" instead of the number and for the multiples of five print "_Buzz_". \\\\For numbers which are multiples of both three and five print "_FizzBuzz_"
for(var i = 0; i < 30; i++){
if(i % 3 == 0) str += "Fizz";
if(i % 5 == 0) str += "Buzz";
if(i % 3 && i % 5){
str += i
}
str += ' '
}
str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment