C program to enter the temperature in Fahrenheit and convert it to Celsius
ADVERTISEMENTS
C program to enter the temperature in Fahrenheit and convert it to Celsius.
There are you will learn how to convert the temperature in Fahrenheit and convert it to Celsius in C language.
Formula:
C = (F - 32) * 5/9
Where:
F = fahrenheit
C = celsius
Let us understand this example through the C program:
// C program to convert the temperature from degree fahrenheit to celsius
#include <stdio.h>
int main() {
float c, f;
// c = celsius
// f = fahrenheit
printf("Enter the temperature in Fahrenheit::\n");
scanf("%f", &f);
/* Conversion of fahrenheit to celsius */
c = (float)((f - 32) * 5 / 9);
// Output
printf("\n%f Fahrenheit = %f Celsius\n", f, c);
return 0;
}
Output:
Enter the temperature in Fahrenheit::
7
7.000000 Fahrenheit = -13.888889 Celsius