Home Jsp Simple-jsp-example Finding Average in JSP



Finding Average in JSP
Posted on: March 11, 2008 at 12:00 AM
In mathematics, an average is a measure of the middle of the data set. The average value is the total amount divided by the total number of elements.

Finding Average in JSP

        

In mathematics, an average is a measure of the middle of the data set. The average value is the total amount divided by the total number of elements.

 

The code of the program is given below:

 

 

 

<HTML>
  <HEAD>
    <TITLE>Finding Average in jsp </TITLE>
  </HEAD>
  <BODY>
  
  <table align= "left" border="1" bgcolor="#FFFFCC">
  <H1>Finding Average in jsp </H1>
    <tr>
	<td>
    <%
        float grades[] = {98, 99, 100, 97, 78, 96};
	float sum, average;
         sum = 0;
        for (int j = 0; j < grades.length; j++) {
            sum = grades[j] + sum;
        }
        average = sum / grades.length;
        out.println("Average grade = " + average);
    %>
	</td>
	</tr>
	</table>
  </BODY>
</HTML>

Output of the program:

 

Download this example.

Related Tags for Finding Average in JSP:
cmathidedatadivvivaluenumberddlidsetelementelementsaveragemounttoeicsincsasmntddtotalemagemeotassuatismeasuremathematicsivdivideeavassthavatialumio


More Tutorials from this section

Ask Questions?    Discuss: Finding Average in JSP  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.