Chapter 2 SOP 5 12th I.T

 SOP 5.html

<!DOCTYPE html>
<html>
<head>
<title>SOP 5 Javascript</title>
</head>
<body>

<h2>JavaScript code to convert Celcius to Fahrenhiet or vice-versa</h2>
<br>
<p>Enter the Temperature</p>

<p><input type="text" id="txt_celsius" onkeyup="convert('C')"> Temperature in degree Celsius</p>
<br>
<p><input type="text" id="txt_fah" onkeyup="convert('F')"> Temperature in degree Fahrenheit</p> 

<script>
function convert(temperature) {
  var t;
  if (temperature == "C") //Celsius to fahrenit
  {
    t = document.getElementById("txt_celsius").value * 9 / 5 + 32;
    document.getElementById("txt_fah").value = Math.round(t);
  } 
  else           //fahrenirt to celsius
   {
    t = (document.getElementById("txt_fah").value -32) * 5 / 9;
    document.getElementById("txt_celsius").value = Math.round(t);
  }
}
</script>

//Note:-you can remove math.round function if you need answer in decimal


</body>
</html>

output

Chapter 2 SOP 5 Solution 12th I.T

Tags :-
12th I.T SOP solution,
12th I.T SOP,
12th I.T chapter 2 SOP solution,
12th I.T chapter 2 SOP 5 solution,
12th I.T SOP 5

Post a Comment

0 Comments