Addition and Subtraction : Operator « JSP « Java






Addition and Subtraction

<HTML>
  <HEAD>
    <TITLE>Addition and Subtraction</TITLE>
  </HEAD>

  <BODY>
    <H1>Addition and Subtraction</H1>
    <%
        int operand1 = 15, operand2 = 24, sum, difference;

        sum = operand1 + operand2;
        difference = operand1 - operand2;

        out.println(operand1 + " + " + operand2 + " = " + sum + "<BR>");
        out.println(operand1 + " - " + operand2 + " = " + difference);
     %>
  </BODY>
</HTML>


           
       








Related examples in the same category

1.Adding value
2.Checking Operator Precedence
3.Using Logical Operators
4.Using Relational Operators
5.Multiplication and Division
6.Incrementing and Decrementing
7.Using Operators