C Program To Convert Fahrenheit To Celsius

Last Updated : 18 Aug, 2026

Fahrenheit and Celsius are two commonly used temperature scales. This program converts a temperature given in Fahrenheit into its equivalent Celsius value.

  • The conversion formula is Celsius = (Fahrenheit - 32) × 5 / 9.
  • The program uses floating-point values to calculate the temperature accurately.

Example:

Input: Fahrenheit = 98.6
Output: Celsius = 37.00

Formula to Convert Fahrenheit to Celsius

T(°C) = (T(°F) - 32) × 5/9

where,

  • T(°C): Temperature in Celsius.
  • T(°F): Temperature in Farenheit.

Approach

The approach is to take the temperature in Fahrenheit and apply the standard conversion formula to obtain the equivalent Celsius temperature.

  • Define the temperature in Fahrenheit.
  • Subtract 32 from the Fahrenheit temperature.
  • Multiply the result by 5/9.
  • Store the converted value in Celsius.
  • Print the Celsius temperature.
C
#include <stdio.h>

// Function to convert Degree
// Fahrenheit to Degree Celsius
float fahrenheit_to_celsius(float f)
{
    return ((f - 32.0) * 5.0 / 9.0);
}

// Driver code
int main()
{
    float f = 40;

    // Passing parameter to function
    printf("Temperature in Degree Celsius : %0.2f",
           fahrenheit_to_celsius(f));
    return 0;
}

Output
Temperature in Degree Celsius : 4.44
Comment