Quick question: you are in London, England and it's $32^\circ$C outside. Is it hot or cold?
In the last lesson you learned how to return a value to a calling statement
from within a function. Let's use such functions to convert between the Fahrenheit and Celsius temperature scales.
We'll use the standard formulas to convert between these two scales, which are $F=\frac{9}{5}C+32$ and $C=\frac{5}{9}(F-32)$.
Now you try. Program in the correct conversion formula into the parenthesis of the return statement.
Type your code here:
See your results here:
This program won't run. You have to fill in something into the return( ) statement's parenthesis. Think carefully now...the function cel2far (short for
"Celsius to Fahrenheit") has a parameter called cel coming into it. Use the variable cel in the proper conversion formula to return the equivalent temperature in $^\circ F$
back to the print statement in the main program.
Share your code
Show a friend, family member, or teacher what you've done!