-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTemperature.rtf
35 lines (35 loc) · 1.4 KB
/
Temperature.rtf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{\rtf1\ansi\ansicpg1252\deff0\deflang16393{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\f0\fs22 <!DOCTYPE html>\par
<html>\par
<head>\par
<title>Temperature Converter</title>\par
</head>\par
<body>\par
<h1>Temperature Converter</h1>\par
\par
<label for="celsius">Celsius:</label>\par
<input type="number" id="celsius" placeholder="Enter Celsius temperature">\par
\par
<label for="fahrenheit">Fahrenheit:</label>\par
<input type="number" id="fahrenheit" placeholder="Enter Fahrenheit temperature">\par
\par
<button onclick="convertToFahrenheit()">Convert to Fahrenheit</button>\par
<button onclick="convertToCelsius()">Convert to Celsius</button>\par
\par
<script>\par
function convertToFahrenheit() \{\par
var celsius = parseFloat(document.getElementById("celsius").value);\par
var fahrenheit = (celsius * 9/5) + 32;\par
document.getElementById("fahrenheit").value = fahrenheit;\par
\}\par
\par
function convertToCelsius() \{\par
var fahrenheit = parseFloat(document.getElementById("fahrenheit").value);\par
var celsius = (fahrenheit - 32) * 5/9;\par
document.getElementById("celsius").value = celsius;\par
\}\par
</script>\par
</body>\par
</html>\par
}