Have you ever wondered what the temperature is, but instead it tells you in the wrong type and you don't know what it is, so you have to look it up? Well, after reading this, you won't have to. You'll hopefully be able to do it in your head.
To convert Celsius to Fahrenheit use the following formula.
Multiply the temperature by 9.
Divide the number you got by 5.
Then add 32.
To convert Fahrenheit to Celsius use the following formula.
Subtract 32 from the temperature.
Multiply that number by 5.
Then divide that number by 9.
But what if you were too lazy to convert it in your head? You can use a programming language such as JavaScript to do the conversion for you.
If you were to type that code into a JavaScvript console, it will output the following.
I'm sure if you were in Grade 3, you'd know how the mathematical formula works, but you might not understand how the JavaScript code works. So, let me break it down for you.
Stands for variable. A variable is used to store a value and use it for later.
Means that the value used in the variable "celsius" is multiplied by 9. That number is then divided by 5 and then added with 32.
Means to output a value, such as a string, an answer to an equation or both. For this, it's both.
Means to output the value of the variable celsius, add the string "°C is ", add the value of the variable celsiusInF, then finally add the string "°F". By "add" I mean to add together not to use addition!
The output will be "30°C is 86°F", provided that you used 30°C as the value for the variable "celsius".
There you go! I hope you learned something!
To convert Celsius to Fahrenheit use the following formula.
Multiply the temperature by 9.
Divide the number you got by 5.
Then add 32.
To convert Fahrenheit to Celsius use the following formula.
Subtract 32 from the temperature.
Multiply that number by 5.
Then divide that number by 9.
But what if you were too lazy to convert it in your head? You can use a programming language such as JavaScript to do the conversion for you.
- Code:
var celsius = 30;
var celsiusInF = (celsius*9)/5 + 32;
console.log(celsius + '°C is ' + celsiusInF + '°F');
var fahrenheit = 20;
var fahrenheitInC = ((fahrenheit - 32)*5)/9;
console.log(fahrenheit + '°F is ' + fahrenheitInC + '°C');
If you were to type that code into a JavaScvript console, it will output the following.
I'm sure if you were in Grade 3, you'd know how the mathematical formula works, but you might not understand how the JavaScript code works. So, let me break it down for you.
- Code:
var
Stands for variable. A variable is used to store a value and use it for later.
- Code:
var celsiusInF = (celsius*9)/5 + 32;
Means that the value used in the variable "celsius" is multiplied by 9. That number is then divided by 5 and then added with 32.
- Code:
console.log
Means to output a value, such as a string, an answer to an equation or both. For this, it's both.
- Code:
console.log(celsius + '°C is ' + celsiusInF + '°F');
Means to output the value of the variable celsius, add the string "°C is ", add the value of the variable celsiusInF, then finally add the string "°F". By "add" I mean to add together not to use addition!
The output will be "30°C is 86°F", provided that you used 30°C as the value for the variable "celsius".
There you go! I hope you learned something!