Go4Expert

Go4Expert (http://www.go4expert.com/)
-   JavaScript and AJAX (http://www.go4expert.com/forums/javascript/)
-   -   Convert Celsius to Fahrenheit (http://www.go4expert.com/forums/convert-celsius-fahrenheit-t18612/)

msn90 18Jul2009 15:03

Convert Celsius to Fahrenheit
 
Program for Convert Celsius to Fahrenheit.i think it's helpful for you.

program code
Code:

<html>
<head>
<script type="text/javascript">
function convert(degree)
{
if (degree=="C")
 {
 F=document.getElementById("c").value * 9 / 5 + 32;
 document.getElementById("f").value=Math.round(F);
 }
else       
 {
 C=(document.getElementById("f").value -32) * 5 / 9;
 document.getElementById("c").value=Math.round(C);
 }
}
</script>
</head>

<body>
<p></p><b>Insert a number into one of the input fields below:</b></p>
<form>
<input id="c" name="c" onkeyup="convert('C')"> degrees Celsius<br />
equals<br />
<input id="f" name="f" onkeyup="convert('F')"> degrees Fahrenheit
</form>
<p>Note that the <b>Math.round()</b> method is used, so that the result will be returned as an integer.</p>
</body>

</html>


xpi0t0s 18Jul2009 15:46

Re: Convert Celsius to Fahrenheit
 
Looks like JavaScript. Why is it dumped in the C-C++ forum?

hotnspicy 18Jul2009 15:48

Re: Convert Celsius to Fahrenheit
 
Sounds interesting, but the same question for me too.

shabbir 18Jul2009 17:20

Re: Convert Celsius to Fahrenheit
 
Moved to Javascript forum


All times are GMT +5.5. The time now is 09:54.