The two most often used temperature scales are as follows:
Celsius is the world’s most widely used temperature scale, commonly known as Centigrade and written as °C. Celsius is most widely used in scientific and medical applications because it is simpler to work with. Fahrenheit (written as °F) is still commonly used in many everyday applications in the United States.
We can convert the temperature from Celsius to Fahrenheit using the formula below.
where, is the Fahrenheit temperature, and is the Celsius temperature.
We are given a temperature value and need to convert that temperature to Fahrenheit using the above formula.
Let’s suppose we have a temperature of degrees Celsius. Putting the value of in the above formula,
Given, .
Let’s see an example of converting the temperature of Celsius to Fahrenheit in JavaScript:
let c = 50;let f = 0;// Using the above formulaf = (c * (9 / 5)) + 32;console.log("The value of the temperature in Fahrenheit is " + f);
c
and f
with values 50
and 0
, respectively.f
.f
to the console.Free Resources