Skip to content

Instantly share code, notes, and snippets.

@jorinvo
Created June 2, 2013 00:06
Show Gist options
  • Save jorinvo/5692125 to your computer and use it in GitHub Desktop.
Save jorinvo/5692125 to your computer and use it in GitHub Desktop.
Try to write FizzBuzz with as little code as possible. Language doesn't matter. This one in javascript is 66 chars.
for(n=0;++n<101;){console.log((n%3?'':'Fizz')+(n%5?'':'Buzz')||n)}
@jorinvo
Copy link
Author

jorinvo commented Jun 2, 2013

Here are the rules:

  • Take and print the numbers between 1 and 100.
  • When a number is divisible by 3, print “Fizz” instead of the number.
  • When it is divisible by 5, print “Buzz” instead.
  • When it is divisible both by 3 and 5, print “FizzBuzz”.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment