Last active
July 31, 2019 09:39
-
-
Save pinchez254/67938d162fbc97918e58dba417a06784 to your computer and use it in GitHub Desktop.
solving Fizz Buzz with JavaScript. Task: 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”.
This file contains hidden or 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
// fizz buzz | |
for (a=1 ; a < 101 ; a ++){ | |
a % 15 == 0 | |
? console.log('fizzBuzz') | |
: a % 3 === 0 | |
? console.log('fizz') | |
: a % 5 === 0 | |
? console.log('Buzz') | |
: console.log(a) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment