Skip to content
Anthony Lawrence edited this page Mar 11, 2018 · 2 revisions

Programming Concepts (Kata: Foo Bar / Fizz Buzz)

Definition of Kata

An individual training exercise (in Karate or other martial art)

Pre-requisite knowledge

  • If a number is divisible by 2, "Foo" should be output.
  • If a number is divisible by 5, "Bar" should be output.
  • If a number is divisible by 2 and 5 (or 10), "FooBar" should be output.
  • If a number is not divisible by these numbers, the number should be output.

Test Cases

  • Singles:
    • 1 => 1
    • 2 => Foo
    • 3 => 3
    • 4 => Foo
    • 5 => Bar
    • 10 => FooBar
  • Sequences:
    • 1, 5 => 1, Foo, 3, Foo, Bar
    • 10, 15 => Foo, 11, Foo, 13, Foo, FooBar
Clone this wiki locally