Convert Fahrenheit to Celsius
°F
How the Converter Works:
-
Input:
- Enter a temperature in Fahrenheit using the input field.
-
Negate Function:
- The
+/−
button toggles the sign of the entered value between positive and negative.
- The
-
Calculation:
- When the “Calculate” button is clicked, the
convertTemperature()
function is called. - The formula for Fahrenheit to Celsius conversion is applied:
- The result is displayed in the format:
X°F = Y°C
, whereY
is the temperature in Celsius, rounded to two decimal places.
- When the “Calculate” button is clicked, the
-
Clear Button:
- The “Clear” button resets both the input field and the result display.
Examples:
-
Example 1:
- Input: 100 °F
- Calculation:
- Result:
100°F = 37.78°C
-
Example 2:
- Input: 32 °F
- Calculation:
- Result:
32°F = 0°C
-
Example 3:
- Input: -40 °F
- Calculation:
- Result:
-40°F = -40°C
Advertisements