9/5
, plus 32
.
You are given a variable celsius
representing a temperature in Celsius. Use the variable fahrenheit
already defined and assign it the Fahrenheit temperature equivalent to the given Celsius temperature. Use the algorithm mentioned above to help convert the Celsius temperature to Fahrenheit.
Don't worry too much about the function and return statements as they will be covered in future challenges. For now, only use operators that you have already learned.
convertToF(0)
should return a number
testString: 'assert(typeof convertToF(0) === ''number'', ''convertToF(0)
should return a number'');'
- text: convertToF(-30)
should return a value of -22
testString: 'assert(convertToF(-30) === -22, ''convertToF(-30)
should return a value of -22
'');'
- text: convertToF(-10)
should return a value of 14
testString: 'assert(convertToF(-10) === 14, ''convertToF(-10)
should return a value of 14
'');'
- text: convertToF(0)
should return a value of 32
testString: 'assert(convertToF(0) === 32, ''convertToF(0)
should return a value of 32
'');'
- text: convertToF(20)
should return a value of 68
testString: 'assert(convertToF(20) === 68, ''convertToF(20)
should return a value of 68
'');'
- text: convertToF(30)
should return a value of 86
testString: 'assert(convertToF(30) === 86, ''convertToF(30)
should return a value of 86
'');'
```