Crate fizzbuzz

source ·
Expand description

FizzBuzz Code Golf

Consider the following problem:

Write a short program that prints each number from 1 to 100 on a new line.

  • For each multiple of 3, print “Fizz” instead of the number.
  • For each multiple of 5, print “Buzz” instead of the number.
  • For numbers which are multiples of both 3 and 5, print “FizzBuzz” instead of the number.
  • Write a solution (or reduce an existing one) so it has as few characters as possible.

Scoring

  • Your score is: 200 - number of characters in your source code) / 100

Source: HackerRank: FizzBuzz

Macros

  • B 🔒
    Macro to print “Buzz
  • F 🔒
    Macro to print “Fizz
  • l 🔒
    Macro to shorten boolean variable definitions

Functions

  • main 🔒
    Rust FizzBuzz in 125 chars
  • pain 🔒
    An even smaller main() function (91 chars)