Skip to content
Related Articles

Related Articles

C Program To Convert Fahrenheit To Celsius

View Discussion
Improve Article
Save Article
  • Last Updated : 19 Jul, 2022

Given a Temperature n in Fahrenheit scale convert it into Celsius scale. Examples:

Input: 32
Output: 0

Input: -40
Output: -40

Formula for converting Fahrenheit scale to Celsius scale

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

C




// C Program to convert
// Fahrenheit to Celsuis
#include <stdio.h>
 
// Function to convert Degree
// Fahrenheit to Degree Celsuis
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

Time Complexity: O(1)

Auxiliary Space: O(1)

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!