Page 146 - Computer Software Application TP - Volume 1
P. 146

COMPUTER SOFTWARE APPLICATION - CITS





















           TASK 2: Using if-else statement

           1  Open the text editor
           2  Write the following codes
              <html >
              <head>
              <title> if statement </title>

              </head>
              <body>
              <script>
              const number = 10;

              if (number % 2 === 0)
              {
              console.log(number+ “ is even.”);
              }
              else
              {

              console.log(number+ “ is odd.”);
              }
              </script>
              </body>

              </html>
           3  Save the program as a .html file
           4  Open the html file with a web browser
           5  Go to the browsers console tab and verify the output.



















                                                           131
                               CITS : IT & ITES - Computer Software Application - Exercise 39
   141   142   143   144   145   146   147   148   149   150   151