Wednesday, 5 December 2012

Performing Basic Mathematical Operations

  1. <html>
  2. <head>
  3. <title>Basic Maths Operations </title>
  4. </head>
  5. <body>
  6. <h3>Addition, Subtraction, Multiplication and Division</h3>
  7. <p>
  8. 5 + 2 = <%=5+2 %>
  9. <br>
  10. 5 - 2 = <%=5-2 %>
  11. <br>
  12. 5 * 2 = <%=5*2 %>
  13. <br>
  14. 5 / 2 = <%=5/2 %>
  15. <br>
  16. 5 % 2 = <%=5%2 %>
  17. <p>
  18.  
  19. </body>
  20. </html>

Description:


  • Type + between two values or variables and use the expression tag to print the result to the Web page.The + operator performs addition.
           5 + 2 = <%=5+2 %>
  • Type - between two values or variables and use the expression tag to print the result to the Web page.The + operator performs subtraction.
             5 - 2 = <%=5-2 %>
  • Type * between two values or variables and use the expression tag to print the result to the Web page.The * operator performs multiplication.
             5 * 2 = <%=5*2 %>
  • Type / between two values or variables and use the expression tag to print the result to the Web page.The / operator performs division.
            5 / 2 = <%=5/2 %>
  • Type % between two values or variables and use the expression tag to print the result to the Web page.The % operator returns the remainder when integer arithmetic is performed.
            5 % 2 = <%=5%2 %>

**********************************OUTPUT**********************************

Addition, Subtraction, Multiplication and Division

5 + 2 = 7
5 - 2 = 3
5 * 2 = 10
5 / 2 = 2
5 % 2 = 1
****************************************************************************


No comments:

Post a Comment