While solving any mathematical problem it becomes important to find the number that is exactly between two numbers.
In this example we are finding a midpoint of two numbers by using the while loop.
The code of the program is given below:
<HTML> <HEAD> <TITLE>Midpoint of two number </TITLE> </HEAD>
<table align= "left" border="1" bgcolor="#FFFFCC"> <H1>Midpoint of two number </H1> <tr> <td> <% short a,b; a=250; b=500; while(++a < --b); out.println("Midpoint is "+a); %> </td> </tr> </table> </BODY> </HTML>
Output of the Program:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: March 11, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles