Home Jsp JSP Modulus
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

JSP Modulus

Advertisement
JSP Modulus is used to determine the modulus of number in jsp. Modulus is the remainder of division operation.

JSP Modulus

        

JSP Modulus is used to determine the modulus of number in jsp. Modulus is the remainder of division operation.

Understand with Example

In this section, you will learn how to determine the modulus of number in jsp. As you already know that modulus is the remainder of division operation. You can see in the given example that we have create two variables i.e. x of integer type and y of float type and assign values to them. Then, we have used the modulus operator, % that will return the remainder of a division operation after dividing the number by 10. 

 

 

Here is the code of modulus.jsp:

<html>
<body>
<h1>Calculate Modulus</h1>
<% int x = 33;
double y = 99.25;
out.println("x mod 10 = " + x % 10+"<br>");
out.println("y mod 10 = " + y % 10);
%>
</body>
</html>

Output will be displayed as:

Download Source Code:

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 3, 2009

Related Tutorials

Ask Questions?    Discuss: JSP Modulus  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com