Skip to content

Instantly share code, notes, and snippets.

@nerocrux
Created May 11, 2012 18:15
Show Gist options
  • Save nerocrux/2661464 to your computer and use it in GitHub Desktop.
Save nerocrux/2661464 to your computer and use it in GitHub Desktop.
fizzbuzz without mod (ruby)
def fizzbuzz(fizz,buzz,fizzbuzz,counter)
if fizzbuzz == 15
print("fizzbuzz ")
fizzbuzz = 0
fizz = 0
buzz = 0
elsif fizz == 3
print("fizz ")
fizz = 0
elsif buzz == 5
print("buzz ")
buzz = 0
else
print(counter, " ")
end
if counter < 100
fizzbuzz(fizz+=1, buzz+=1, fizzbuzz+=1, counter+=1)
end
end
fizzbuzz(1,1,1,1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment