Created
March 25, 2014 12:10
-
-
Save itskingori/9760562 to your computer and use it in GitHub Desktop.
Outputs each number from 1 to 100, however … when the number is a multiple of 3 print WAKKA instead of that number. When the number is a multiple of 5, print WAAAA instead of that number. For numbers which are multiples of 3 AND 5, print WAKKAWAAAA.
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
#!/usr/bin/env ruby | |
(1..100).each { |n| | |
puts n unless( n%3 == 0 || n%5 == 0) | |
puts 'WAKKA' if (n%3 == 0 && n%5 != 0) | |
puts 'WAAAA' if (n%5 == 0 && n%3 != 0) | |
puts 'WAKKAWAAAA' if (n%3 == 0 && n%5 == 0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment