#include <stdio.h>
// add function prototypes
float toCelsius (float theFahrenheitTemp);
float toFahrenheit (float theCelsiusTemp);
int main ()
{
float celsius;
float fahrenheit;
printf ("\n Celsius to Fahrenheit \n"); printf("----------------------\n"); // create some loop to print
for (int i = 0; i <= 100; i++)
{
printf ("%4d %12.1f \n", i
, toFahrenheit
(i
)); }
printf ("\n Fahrenheit to Celsius \n"); printf("--------------------- \n"); // create some loop to print
for (int i = 32; i <= 212; i++)
{
printf ("%4d %12.1f \n", i
, toCelsius
(i
)); }
// call and print results from each of the functions
}
// add your two function definitions here
// add function header comments
float toCelsius (float theFahrenheitTemp)
{
float celsius; //celcius tempurture
celsius = (theFahrenheitTemp - 32) * 5 / 9;
return celsius;
} //toCelsius
// add function header comments
float toFahrenheit (float theCelsiusTemp)
{
float fahrenheit; //fahrenheit tempurture
fahrenheit = ((theCelsiusTemp / 5) * 9) + 32;
return fahrenheit;
} //toFahrenheit
I2luY2x1ZGUgPHN0ZGlvLmg+CgovLyBhZGQgZnVuY3Rpb24gcHJvdG90eXBlcyAKZmxvYXQgdG9DZWxzaXVzIChmbG9hdCB0aGVGYWhyZW5oZWl0VGVtcCk7CmZsb2F0IHRvRmFocmVuaGVpdCAoZmxvYXQgdGhlQ2Vsc2l1c1RlbXApOwoJCmludCBtYWluICgpCnsKCiAgICBmbG9hdCBjZWxzaXVzOwogICAgZmxvYXQgZmFocmVuaGVpdDsKCiAgICBwcmludGYgKCJcbiBDZWxzaXVzIHRvIEZhaHJlbmhlaXQgXG4iKTsKICAgIHByaW50ZigiLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuIik7CiAgIC8vIGNyZWF0ZSBzb21lIGxvb3AgdG8gcHJpbnQgCiAgICBmb3IgKGludCBpID0gMDsgaSA8PSAxMDA7IGkrKykKICAgIHsKICAgICAgICBwcmludGYgKCIlNGQgJTEyLjFmIFxuIiwgaSwgdG9GYWhyZW5oZWl0KGkpKTsKICAgIH0KCnByaW50ZiAoIlxuIEZhaHJlbmhla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