Share on Google+Share on Google+

Convert Celsius to Fahrenheit

Celsius is a unit to measure temperature scale on which water freezes at 0 degree and boiling point is 100 degree.

Convert Celsius to Fahrenheit


Celsius is a unit to measure temperature scale on which water freezes at 0 degree and boiling point is 100 degree. This unit is discovered by Celsius in 1742, a Swedish astronomer and physicist, he has invented the centigrade, or Celsius thermometer divided between the freezing and boiling points of water into 100 parts. 

Fahrenheit Scale was invented by Daniel Gabriel Fahrenheit , he was the German physicist who invented the temperature scale that was patented by his name Fahrenheit Scale.

In this example you will learn how to convert the temperature Celsius to Fahrenheit. To change the Celsius to Fahrenheit we have the formula Fahrenheit = 32 + 9 * c / 5. To change the Celsius to Fahrenheit we need one html page which will take any value as a Celsius and later this Celsius parameter will be get into the jsp page and the formula will be implemented on  this variable and the result will be displayed to you. All this processing will be done inside the scriptlet directive.  

The code of the program is given below.

<title>Convert Celsius to Fahrenheit Jsp</title>
<table border="1" cellpadding="0"
   cellspacing="0" width="35%" align="center">

    <td width="100%">
     <p align="center"><b>Convert Celsius to Fahrenheit Jsp</b></p>
     <form method="POST" action="Celsius-to-Fahrenheit.jsp">
        <p align="center"><b>Enter Temprature in Celsius:</b>
	<input type="text" name="cel" size="20">
        <input type="submit" value="Convert" name="B1"></p>
		String str=request.getParameter("cel");
			if(str == null || str.equals("")){ 
			 float c=Float.parseFloat(str);
			float f = 32 + 9*c/5;


Download this example.



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

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.

Discuss: Convert Celsius to Fahrenheit   View All Comments

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
June 15, 2011
convert celcius

it is very good