Convert Fahrenheit To Celsius C Program

By | March 14, 2016

C Program To Convert Fahrenheit To Celsius

Learn How To Convert Fahrenheit To Celsius in C Programming Language. This C Code For Temperature Conversion from Fahrenheit into Celsius is developed using Simple Mathematical Operators.

Formula To Temperature Conversion From Fahrenheit To Celsius:

Celsius = (Fahrenheit – 32 ) / (9/5)

This Formula can be modified as:

Celsius = (Fahrenheit – 32 ) / (1.8)

Note: This C Program To Convert Temperature from Fahrenheit To Celsius is developed in Linux Ubuntu Operating System and compiled with GCC Compiler.

C Program To Convert Fahrenheit To Celsius without Function

#include<stdio.h>

int main()
{
      double celsius, fahrenheit;
      printf("\nEnter The Temperature in Fahrenheit: \t ");
      scanf("%lf", &fahrenheit);
      celsius = (fahrenheit - 32)/1.8;
      printf("\nTemperature in Celsius: \t %lf", celsius);
      printf("\n");
      return 0;
}

Convert Fahrenheit into Celsius in C Programming using Function

#include<stdio.h>

double temperature_conversion(double f)
{
      double celsius;
      celsius = (f - 32)/1.8;
      return celsius;
}

int main()
{
      double fahrenheit;
      printf("\nEnter The Temperature in Fahrenheit: \t ");
      scanf("%lf", &fahrenheit);
      printf("\nTemperature in Celsius: \t %lf", temperature_conversion(fahrenheit));
      printf("\n");
      return 0;
}

Also Read: Temperature Conversion From Celsius To Fahrenheit in C Programming

 

Output

Convert Fahrenheit To Celsius in C Programming Language

If you have any Compilation Errors with this C Program Code For Temperature Conversion or if you have any doubts about this Program, let us know about it in the Comment Section below.

Let's Discuss