Created
December 9, 2012 06:39
-
-
Save dominickm/4243621 to your computer and use it in GitHub Desktop.
FizzBuzz Ruby
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
| 1.upto(100) do |num| | |
| if (num % 15).zero? | |
| puts "FizzBuzz" | |
| elsif (num % 5).zero? | |
| puts "Buzz" | |
| elsif (num % 3).zero? | |
| puts "Fizz" | |
| else | |
| puts num | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment