## C program to convert temperature from degree fahrenheit to celsius

Write a C program to input temperature in degree Fahrenheit and convert it to degree Centigrade. How to convert temperature from Fahrenheit to Celsius in C programming. C program for temperature conversion. Logic to convert temperature from Fahrenheit to Celsius in C program.

#### Required knowledge

Data Types in c, Input/Output in C, Operators, Variables in C

#### Temperature conversion formula

Formula to convert temperature from degree Fahrenheit to degree Celsius is given by -

#### Logic to convert temperature from Fahrenheit to Celsius

Step by step descriptive logic to convert temperature from degree Fahrenheit to degree Celsius -

1. Input temperature in fahrenheit from user. Store it in some variable say fahrenheit.
2. Apply the temperature conversion formula celsius = (fahrenheit - 32) * 5 / 9.
3. Print the value of celsius.

#### Program to convert temperature from Fahrenheit to Celsius

```
/**
* C program to convert temperature from degree fahrenheit to celsius
*/

#include <stdio.h>

int main()
{
float celsius, fahrenheit;

/* Input temperature in fahrenheit */
printf("Enter temperature in Fahrenheit: ");
scanf("%f", &fahrenheit);

/* Fahrenheit to celsius conversion formula */
celsius = (fahrenheit - 32) * 5 / 9;

/* Print the value of celsius */
printf("%.2f Fahrenheit = %.2f Celsius", fahrenheit, celsius);

return 0;
}
```

%.2f is used to print fractional values only up to two decimal places. You can also use %f to print fractional values normally up to six decimal places.

##### Output:
```
Enter temperature in Fahrenheit: 205
205.00 Fahrenheit = 96.11 Celsius
```
```
Recommended posts

Loop programming exercises index.
Basic programming exercises index.
If else programming exercises index.
Array programming exercises index.
String programming exercises index.
Pointer programming exercises index.
Star Patterns exercises index.
Number Patterns exercises index.
alphabet Patterns exercises index.
series program exercises index.

```