curriculum/challenges/english/blocks/lab-celsius-to-fahrenheit-converter/56533eb9ac21ba0edf2244b3.md
In this lab, you will write a function that converts the temperature from Celsius to Fahrenheit. The formula to convert from Celsius to Fahrenheit is:
fahrenheit = celsius * (9/5) + 32
Objective: Fulfill the user stories below and get all the tests to pass to complete the lab.
User Stories:
convertCtoF.convertCtoF should take a single numeric argument, which is the temperature in Celsius.convertCtoF should return a number.You should create a function named convertCtoF.
assert.isFunction(convertCtoF);
convertCtoF should take a single parameter.
assert.lengthOf(convertCtoF, 1);
convertCtoF(0) should return a number.
assert.isNumber(convertCtoF(0));
convertCtoF(-30) should return a value of -22.
assert.strictEqual(convertCtoF(-30), -22);
convertCtoF(-10) should return a value of 14.
assert.strictEqual(convertCtoF(-10), 14);
convertCtoF(0) should return a value of 32.
assert.strictEqual(convertCtoF(0), 32);
convertCtoF(20) should return a value of 68.
assert.strictEqual(convertCtoF(20), 68);
convertCtoF(30) should return a value of 86.
assert.strictEqual(convertCtoF(30), 86);
function convertCtoF(celsius) {
let fahrenheit = celsius * (9 / 5) + 32;
return fahrenheit;
}
convertCtoF(30);