FizzBuzz: The Ultimate Programmer Weed Out

Posted by hank, Tue Feb 27 19:56:00 UTC 2007

My solution to this problem:

(1..100).each do |i|
  puts i%3==0 && i%5==0 ? "FizzBuzz" : i%5==0 ? "Buzz" : i%3==0 ? "Fizz" : i
end

This should be trivial for just about any programmer. Took me 40 seconds or so.

Tags:

Comments

Have your say

A name is required. You may use Markdown in your comments.