Hacker News new | ask | show | jobs
by mrob 3723 days ago
Even if you've never heard of the modulus operator, it's still easy, eg in Python:

  fizz = 3
  buzz = 5
  both = 15

  for i in range(1, 101):
      if i == both:
          print "FizzBuzz"
          both += 15
          fizz += 3
          buzz += 5
      elif i == fizz:
          print "Fizz"
          fizz += 3
      elif i == buzz:
          print "Buzz"
          buzz += 5
      else:
          print i