C Program to Convert Fahrenheit to Celsius

How to write a C program to convert Fahrenheit to Celsius with an example. The math formula behind the temperature conversion from degree Fahrenheit to Celsius in C is Celsius = (5 / 9) * (Fahrenheit – 32). For instance, 220 degrees Celsius c equals 428 f. And 200 f to c equals 93.3333

C Program to Convert Fahrenheit to Celsius

This C program to convert Fahrenheit to Celsius lets the user enter the temperature value in Fahrenheit. Next, using the F to formula, this program converts the temperature in Fahrenheit to Celsius.

#include <stdio.h>
 
int main()
{
    float celsius, fahrenheit;
 
    printf("Please Enter the temperature in Fahrenheit: \n");
    scanf("%f", &fahrenheit);
 
    // Convert the temperature from f to c formula
    celsius = (fahrenheit - 32) * 5 / 9;
    //celsius = 5 *(fahrenheit - 32) / 9;
    //celsius =(fahrenheit-32) * 0.55556; 

    printf("\n %.2f Fahrenheit = %.2f Celsius", fahrenheit, celsius);
 
    return 0;
}
C program to convert Fahrenheit to Celsius 1

All of us know the boiling point of water in Fahrenheit is 212 degrees Fahrenheit. The freezing point of water is 32 degrees Fahrenheit.

Analysis of this C program to convert Fahrenheit to Celsius conversion example:

The first two statements ask the user to enter the temperature value. Next, the scanf statement will assign the user entered values to an already declared variable.

We can use any of the following formulas that we specified in the above code to convert the temperature in F to C

celsius = (Fahrenheit – 32) * 5 / 9

The last C Programming printf statement will print the output

printf("\n %.2f Fahrenheit = %.2f Celsius", fahrenheit, celsius);

Let me show you the Celsius value of 32 degrees Fahrenheit. Similarly, 100f to c is 37.7778. Next, 200 f to c is 93.3333

Please Enter the temperature in Fahrenheit: 
32

 32.00 Fahrenheit = 0.00 Celsius


Please Enter the temperature in Fahrenheit: 
100

 100.00 Fahrenheit = 37.7778 Celsius

Please Enter the temperature in Fahrenheit: 
200

 200.00 Fahrenheit = 93.3333 Celsius