BIZZ BUZZ


Here is a good way to start working with loops.
Print out all the numbers between 1 and 100.
If the number is divisible by 3 say BIZZ. If its divisible by 5 say BUZZ.

For an example click here


Directions
  1. Create an HTML page with the name of the project and the instructions text on top.

  2. Add a <script> section and use a loop to print out all the numbers between 1 and 100, one per line.

  3. Next, for each number, also show the result of the number divided by 3, like this:

    10 ... / 3 = 3.3333
    11 ... / 3 = 3.6666
    12 ... / 3 = 4.0


    HINT : declare a string (var myLine) and for each line, add the elements you want to show to it. (myLine +=) Then print using document.write (myLine); when the line is "complete".

  4. Now change each line to show the remainder for each number divided by 3:

    10 ... / 3 remainder = 0.3333
    11 ... / 3 remainder = 0.666
    12 ... / 3 remainder = 0.0



  5. Change your code to just say BIZZ if the number is divisible by 3, like so:

    10...
    11...
    12...BIZZ.



  6. Now show BUZZ if the number is divisible by 5, like so

    10... BUZZ.
    11...
    12...BIZZ.



  7. Make them print in the proper colors.

  8. EXTRA CREDIT - look up what MOD division is (HINT: the MOD operator is %) and use MOD to check if the number is evenly divisible.







(c) 2016 by Code Craft Academy