convert Fahrenheit to celsius in C program

convert Fahrenheit to celsius in C program

In this program, we are going to discuss how to convert temperature from Fahrenheit to Celcius.

So let’s start!

For Example –


For example, we are taking the user input in form of temperature so,

Enter the temperature :

so we are taking the temperature as 100.


If you want to convert Fahrenheit to celsius then we have to use a formula for this conversion, so we are going to use the formula as follows:

Celsius = (fehrenheit – 32) *5/9

This is the main logic we going to use in this program so let’s implement this format in our program.

Output :

According to our input, we get an output after converting the temperature from celsius to kelvin

The equivalent temperature is 37.77

//C program to convert temperature from fehrenheit to celcius.

int main(){
float Fahrenheit, celsius;
printf(“Enter a temperature:”);
scanf(“%f”, &fahrenheit);
celsius = (Fahrenheit -32)*5/9;
printf(“Equivalent temperature is %0.2f”,celsius);
return 0;


Enter a temperature: of 100

The equivalent temperature is 37.77

Explanation :

Step 1: first of all to convert the temperature from Fahrenheit to celsius you have required to float type variable. One is for user input and the other is to calculate the value of celsius. So from the above example, we take two float-type variables that are Fahrenheit and celsius.

Step 2: Apply the formula which is :

celsius = (Fahrenheit -32) 5/9

Step 3: After this, we use printf statement to get the output of our program.

So In this way, we simply convert the temperature from Fahrenheit to celsius. I hope this concept is clear to you. You can also explore these examples by putting another value on them. So for now keep exploring and keep learning!