Skip to content

Instantly share code, notes, and snippets.

@kawaynejohnson
Created November 17, 2015 21:23
Show Gist options
  • Save kawaynejohnson/4a5fef425850f96ba76b to your computer and use it in GitHub Desktop.
Save kawaynejohnson/4a5fef425850f96ba76b to your computer and use it in GitHub Desktop.
Temperature
/*
Forumula for converting Celcius to Fahrenheight
ºF = ºC * 1.8 + 32.00
Forumula for converting Fahrenheight to Celcius
°C = (°F - 32) * .55
The following function converts Celcius to Kelvin
°K = °C + 273.15
*/
// 1. Create the variable "degreesInCelsius" and set it to the number 35
var degreesInCelsius=35;
// 2. Create a variable "degreesInFahrenheight"
var degreesInFahrenheight;
// 3. Convert "degreesInCelsius" to Fahrenheight using the formula and save it in "degreesInFahrenheight"
degreesInFahrenheight=degreesInCelsius * 1.8+32.00;
// 4. Log the value of "degreesInFahrenheight"
console.log(degreesInFahrenheight);
// 5. Convert "degreesInFahrenheight" back to Celcius using the formula and save it in "degreesInCelsius"
degreesInCelsius=(degreesInFahrenheight -32)*.55;
// 6. Log the value of "degreesInCelsius"
console.log(degreesInCelsius);
// 7. Convert "degreesInCelsius" to Kelvin using the formula and save it in "degreesInKelvin"
var degreesInKelvin = degreesInCelsius+ 273.15;
// 8. Log the value of "degreesInKelvin"
console.log(degreesInKelvin);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment