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>

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>