JavaScript Project – Temperature Converter
Full Stack Web Development Courses with Real-time projects Start Now!!
Program 1
// Temperature Converter
// fahrenheit=((celsius*9)/5) +32
// celsius=((fahrenheit-32)*5)/9
let c=23.45
f=((c*9)/5) +32
console.log("fahrenheit temperature is : "+f)
Program 2
<html>
<head><title>Temperature Converter</title>
<script language="javascript">
function ctof()
{
let c,f
c=document.getElementById("cel").value
f=((c*9)/5) +32
//alert(f)
document.writeln("<center>")
document.writeln("<font color=red size=6>Fahrenheit temp: "+f+"</font>")
document.writeln("</center>")
}
</script>
</head>
<body>
<center>
<form>
<table border=1>
<tr>
<th>Celsius: </th>
<td><input type=text name=txt1 id="cel"></td>
<td></td>
<td><input type="button" value="Fahrenheit" onclick="ctof();" ></td>
</tr>
</table>
</form>
</center>
</body>
</html>
Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google

