Skip to content

Instantly share code, notes, and snippets.

@wilkinsbrian
Created July 13, 2014 19:59
Show Gist options
  • Save wilkinsbrian/e6fc05fbd6ab96e87cd0 to your computer and use it in GitHub Desktop.
Save wilkinsbrian/e6fc05fbd6ab96e87cd0 to your computer and use it in GitHub Desktop.
Ruby FizzBuzz with If Statement
def fizzbuzz(n)
if (n % 3 == 0)
puts "Fizz"
end
if (n % 5 == 0)
puts "Buzz"
end
if !((n % 3 == 0) || (n % 5 == 0))
puts n
end
end
(1..100).each {|n| fizzbuzz n}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment