Skip to main content

C PROGRAM: Simple explanation of c program to convert Celsius to Fahrenheit and kelvin.

C Programming


We will be discussing about the program to convert Celsius to Fahrenheit and kelvin. How can we convert it??...

For that we should first know what are  Celsius, Fahrenheit and kelvin. And relation between them.

Celsius(c), Fahrenheit(f) and kelvin(k) are the units of temperature. They are used to measure the temperature.

Relation between them:

    Celsius to kelvin:  k=c+273.
    kelvin to Celsius:  c=k-273.

    Celsius to Fahrenheit:  f=1.8*c + 32.
    Fahrenheit to Celsius:  c=(f-32)/1.8.

    Fahrenheit to kelvin:  k=f + 457.87.
    kelvin to Fahrenheit:  f=k - 457.87.



C program to convert Celsius to Fahrenheit and kelvin.

c program to convert Celsius to Fahrenheit

  • Header file stdio.h standard input and output to get input and show output, conio.h console input and output.
  • void main -  function returning value will be null.
  • float - declare the type of variable(k for Kelvin, c for Celsius, f for Fahrenheit.
  • clrscr - clear the screen.
  • printf - used to print in output screen.
  • scanf - used to accept input (%f), and read (&C).
  • getch - used to hold the screen until the user gives any type of input.
  • \n is used to print next statement in next line in output screen.

OUTPUT:

output of c program to convert Celsius to Fahrenheit


The above program helps us to convert Celsius to Fahrenheit, kelvin. Using this format you can also try to convert kelvin to Celsius, Fahrenheit and Fahrenheit to kelvin, Celsius.

 I have mentioned the relation above, try it out on your own. If you find errors or doubt mention in the comment below.

Recommended..


In following days we will discuss more programs in detail. If you like to learn more just follow me regularly. If you have any question to ask mention below in comment.Thank you......



Comments