Skip to content

Instantly share code, notes, and snippets.

@hhoopes
Created December 1, 2015 16:43
Show Gist options
  • Save hhoopes/ea5c5f696f17523dcc26 to your computer and use it in GitHub Desktop.
Save hhoopes/ea5c5f696f17523dcc26 to your computer and use it in GitHub Desktop.
SuperFizzBuzz homework
## SuperFizzBuzz Clear
# Heidi Hoopes
# Missed the 3 & 5 case, so need to add that in
range = 0..1000
range.each do |n|
a,b,c = ''
num = n
# divisible by 7
if n % 7 == 0
a = "Super"
num = ''
end
# divisible by 3
if n % 3 == 0
b = "Fizz"
num = ''
end
# divisible by 5
if n % 5 == 0
c = "Buzz"
num = ''
end
puts "#{a}#{b}#{c}#{num}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment