Program to Convert Fahrenheit to Celcius in C

C




// C Program to convert
// Fahrenheit to Celsius
#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

Complexity Analysis

  • Time Complexity: O(1)
  • Auxiliary Space: O(1)

Please refer complete article on the Program for Fahrenheit to Celsius conversion for more details!


C Program To Convert Fahrenheit To Celsius

In this article, we will learn to write a C Program to convert temperature from Fahrenheit to Celsius by applying the conversion formula to calculate the equivalent temperature in Celsius. For example, 82° in Fahrenheit is equal to 27.7° in Celcius.

Similar Reads

Formula to Convert Fahrenheit to Celsius

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

Algorithm

Define temperature in Fahrenheit Units. Apply the formula to convert temperature in Fahrenheit to Celsius. Print the temperature in Celsius....

Program to Convert Fahrenheit to Celcius in C

C // C Program to convert // Fahrenheit to Celsius #include    // 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; }...