This Gist was automatically created by Carbide, a free online programming environment.
Created
August 24, 2016 13:25
-
-
Save antimatter15/0c4c35a2b3bcba53fd7f0c6a20476fc8 to your computer and use it in GitHub Desktop.
Fizz Buzz
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
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