Advertisement
Guest User

Untitled

a guest
Oct 4th, 2015
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. class Fixnum
  2.  
  3. def fizzbuzz
  4. if self % 3 == 0 && self % 5 == 0
  5. return "fizzbuzz"
  6. elsif self % 5 == 0
  7. return "buzz"
  8. elsif self % 3 == 0
  9. return "fizz"
  10. else
  11. return self
  12. end
  13. end
  14.  
  15. end
  16.  
  17. big_buzz = []
  18. 1001.times do |n|
  19. big_buzz << n.fizzbuzz
  20. end
  21. puts big_buzz
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement