Kilometers per Liter to Miles per Gallon

Kilometers per liter : The distance traveled by a vehicle which is running on gasoline or diesel fuel in a kilometer.

Kilometers per Liter to Miles per Gallon

        

Kilometers per liter : The distance traveled by a vehicle which is running on gasoline or diesel fuel in a kilometer. 

Miles per Gallon: The distance traveled by a vehicle which is running on gasoline or diesel fuel in a mile.

Suppose we need to convert the kilometers per liter into miles per gallon then there is one formula by which we can convert the kmpl to mpg that is mpg = kmpl * Conversion_factor. The value of the conversion factor is 2.352145 which is constant.

 

The code of the program is given below:

 

<html>
<head>
<title>ConversionTable of Kilometers perLiter and Miles per Gallon </title>
</head>
<body>
<FONT SIZE="6" COLOR="#CC99FF">ConversionTable of Kilometers
perLiter and Miles per Gallon</FONT>
<table border="1" bgcolor="#CCCCFF">
<tr><td><b>Kilometers per Liter</b></td><td><b>Miles per Gallon</b></td><tr>
<%
double kmpl=0.0;
double mpg=0.0;
final double CONVERSION_FACTOR = 2.352145;
>for ( kmpl = 5; kmpl < 25;kmpl++){
		mpg = kmpl * CONVERSION_FACTOR;
	%>	
<tr>
<td><%=kmpl%>
</td>
<td><%=mpg%>
</td>
</tr>
<%    
}
%>
</table>
</body>
</html>

Output of the Program:

Download this example.

Advertisements

Share on Google+Share on Google+

Kilometers per Liter to Miles per Gallon

Posted on: March 12, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: Kilometers per Liter to Miles per Gallon  

Post your Comment


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

Ads

 

Ads