The best way to get more comfortable with functions is to simply practice writing code. So here we go!
Subsection12.3.1Functions: Your Turn!
Activity12.1.
Write a C program that converts temperature from Fahrenheit to Celsius or from Celsius to Fahrenheit, depending on user input. Here is a sample session:
Please enter a temperature: 45 F
45 degrees Fahrenheit correspond to approximately 7.2 degrees Celsius.
And another sample session:
Please enter a temperature: 28 C
28 degrees Celsius correspond to approximately 82.4 degrees Fahrenheit.
The overall structure of the program is provided for you below. Your program should use functions for the temperature conversions: one for Fahrenheit to Celsius, and another for Celsius to Fahrenheit.
Write a function factorial() that accepts an integer as an argument and returns an integer, namely the factorial of the argument. A test program has already been provided for you below; you only need to write the function itself and add the prototype and the function call to the program.