Fuzz Buzz

Any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizzbuzz. A player who makes a mistake has to take a drink.
Einstein will choose a random number to start with – for example: 4, buzz, fizz, 7, 8, fizz, buzz, 11, fizz, 13, 14, fizzbuzz…

Coding Kata

<script type="text/javascript">
   var i=0;
   for (i=0;i< =100;i++) {
      if (i%3 == 0 && i%5 == 0) {
         document.write("The number is Fuzz Buzz");
         document.write("<br />");
      } else
      if (i%3 == 0) {
         document.write("The number is Fuzz");
         document.write("<br />");
      } else if (i%5 == 0) {
         document.write("The number is Buzz");
         document.write("<br />");
      } else {
         document.write("The number is " + i);
         document.write("<br />");
      }
   }
</script>
  1. No comments yet.

  1. No trackbacks yet.