c-programs-basics
We going to perform the c program of temperature conversion from Fahrenheit to Celsius and vice versa.
We can use the following formulas to do so :
C = (f-32)/1.8.
 f = 1.8 * C + 32.

C Program To Convert Temperature From Fahrenheit To Celsius

#include<stdio.h>
#include<conio.h>

void main()
{
 float celsius, fahrenheit;
 clrscr();

 printf("\n Enter Temp in Fahrenheit : ");
 scanf("%f", &fahrenheit);

 celsius = (fahrenheit-32) / 1.8;
 printf("\n Temperature in Celsius : %.2f ", celsius);

 getch();

}

Output :


Output-Temperature-Conversion-Fahrenheit-to-Celsius



Temperature Conversion From Celsius to Fahrenheit C Program

#include<stdio.h>
#include<conio.h>

void main()
{
 float celsius, fahrenheit;
 clrscr();

 printf("\n Enter Temp in Celsius : ");
 scanf("%f", &celsius);

 fahrenheit = (1.8 * celsius) + 32;
 printf("\n Temperature in Fahrenheit : %.2f ", fahrenheit);

 getch();

}

Output :


Output-Temperature-Conversion-Celsius-to-Fahrenheit


In this way we can easily convert temperature from fahrenheit to celsius and vice versa.