Skip to content

Instantly share code, notes, and snippets.

@dlresende
Created February 28, 2017 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlresende/cd2234a777d75eb2235dbde70a13349c to your computer and use it in GitHub Desktop.
Save dlresende/cd2234a777d75eb2235dbde70a13349c to your computer and use it in GitHub Desktop.

Fizz Buzz Kata

Build a program that takes a number N as input and for each number from 1 to N:

  • If the number is divisible by 3, should print "Fizz";
  • If the number is divisible by 5, should print "Buzz";
  • If the number is divisible by both 3 and 5, should print "Fizz Buzz";
  • Otherwise, should print the number.

Example:

$ fizzbuzz 15
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment