Wednesday, 5 December 2012

Performing Basic Mathematical Operations

<html>
<head>
<title>Basic Maths Operations </title>
</head>
<body>
<h3>Addition, Subtraction, Multiplication and Division</h3>
<p>
5 + 2 = <%=5+2 %>
<br>
5 - 2 = <%=5-2 %>
<br>
5 * 2 = <%=5*2 %>
<br>
5 / 2 = <%=5/2 %>
<br>
5 % 2 = <%=5%2 %>
<p>

</body>
</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