Write this program in c The temperature in Fahrenheit can b

Write this program in c :
The temperature in Fahrenheit can be expressed in Celsius as follows:
f(c)=(9/5)c+32
where c is the temperature in Celsius and f the temperature in Fahrenheit. Plot the relation when the temperature varies in the range of [-10, 40] degrees in Celsius. Make
sure that in your program you have a function to do the conversion.
Write this program in c :
The temperature in Fahrenheit can be expressed in Celsius as follows:
f(c)=(9/5)c+32
where c is the temperature in Celsius and f the temperature in Fahrenheit. Plot the relation when the temperature varies in the range of [-10, 40] degrees in Celsius. Make
sure that in your program you have a function to do the conversion.
Write this program in c :
The temperature in Fahrenheit can be expressed in Celsius as follows:
f(c)=(9/5)c+32
where c is the temperature in Celsius and f the temperature in Fahrenheit. Plot the relation when the temperature varies in the range of [-10, 40] degrees in Celsius. Make
sure that in your program you have a function to do the conversion.

Solution

Ans)

#include <stdio.h>
float tempConv(int a); //declare a global function
int main()
{
    float c;//initialize c for celcius
    float farenheit;//initialize farenheit for farenheit temperature
    printf(\"Enters temperature in celsius: \"); //ask user to enter temperature in celsius
    scanf(\"%f\",&c);//read from input  
    farenheit = tempConv(c);////call a tempConv() function
    printf(\"%.2fC is equal to %.2fF\ \",c, farenheit);//after calling the function print the final result
    return 0;
}
float tempConv(int a) //implementing the function tempConv()
{
    float result =(9.0/5.0) * a + 32;//logic to convert the celsius to farenheit
    return result; // return the result statement
}

output:

Enters temperature in celsius: -10.00C is equal to 14.00F
Enters temperature in celsius: -5.00C is equal to 23.00F
Enters temperature in celsius: 0.00C is equal to 32.00F
Enters temperature in celsius: 5.00C is equal to 41.00F
Enters temperature in celsius: 10.00C is equal to 50.00F
Enters temperature in celsius: 15.00C is equal to 59.00F
Enters temperature in celsius: 20.00C is equal to 68.00F
Enters temperature in celsius: 25.00C is equal to 77.00F
Enters temperature in celsius: 30.00C is equal to 86.00F
Enters temperature in celsius: 35.00C is equal to 95.00F
Enters temperature in celsius: 40.00C is equal to 104.00F

Here from output which I got I observed that for every constant rise temperature in celsius there is a constant rise in farenheit temperature.In the above output for every 5 degree risse in temperature there is 7 degree rise in farenheit.

 Write this program in c : The temperature in Fahrenheit can be expressed in Celsius as follows: f(c)=(9/5)c+32 where c is the temperature in Celsius and f the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site