C Program To Convert Temperature | LearntHub

Hello friends, in this post today, we will learn the concept that how to convert temperature from degree Celsius to Fahrenheit with the help of program.

Convert From C To F:-

Formula to convert temperature from C to F is given below.
    F = (1.8*C)+32
Where,
  • F = Temperature In Fahrenheit
  • C = Temperature In Celsius
Using the above formula, we can simply convert temperature from degree Celsius to Fahrenheit.
  1. Variables And Constants
  2. First C Program
  3. FlowChart
  4. Operators
    Convert temperature

Program:-


Output:

Enter temperature in C:45
Temperature in F=113.00
Declaration of above program:
1. First input some variables c(celsius) and f(Fahrenheit).
2. Convert temperature from C to F using the following operator's formula.
F = (1.8*C)+32
3. Finally, print the value of F.

Convert From F To C:-

Formula to convert temperature from F to C is given below.
    C = ((F-32)/1.8)
Where,
  • F = Temperature In Fahrenheit
  • C = Temperature In Celsius
Using the above formula, we can simply convert temperature from degree Fahrenheit to Celsius.

Output:

Enter temperature in F: 99
Temperature in C= 37.22
Declaration of above program:
1. First input some variable f(Fahrenheit) c(celsius).
2. Convert temperature from F to C using the following operator's formula.
 C=((F-32)/1.8);
3. Finally, print the value of C.

Covert From K To F:-

Formula to convert temperature from K to F is given below.
    F = ((K*1.8)-459.67)
Otherwise if we want to convert temperature from F to K, we will use the following formula:
K = ((F+459.67)*1.8)
Where,
  • F = Temperature In Fahrenheit
  • K = Temperature In Kelvin
Using the above formula, we can simply convert temperature from Kelvin to degree Fahrenheit.

Output:

Enter temperature in K: 312
Temperature in F= 101.93
Declaration of above program:
1. First input some variable f(Fahrenheit) k(kelvin).
2. Convert temperature from F to C using the following operator's formula.
 F=((K*1.8)-459.67);
3. Finally, print the value of F.

Post a Comment

0 Comments