## Introduction

In this blog, we will discuss the solution to the problem of converting Fahrenheit to** **Celsius. We will code the solution to this problem in C language. But before discussing the solution to this problem, we should first try to understand the context of Fahrenheit and Celsius. After that, we will look at the conversion of Celsius to Fahrenheit.

As we all know, temperature measures the degree of hotness and coldness. Celsius and Fahrenheit are both units of temperature used to measure the temperature. Celsius is also known as centigrade, and most countries use it. On the other hand, Fahrenheit is majorly used by the United States. Celsius is represented by **Â°C, **and Fahrenheit is represented by **Â°F. **Now, we should look at the conversion formula from Fahrenheit to Celsius.

### Sample Examples

**Example 1:**

```
Input:
F (Temperature in Fahrenheit) = 32
Output
0 degrees in Celsius
Explanation
(32-32) * (5/9)= 0 *(5/9) = 0
```

**Example 2:**

```
Input:
F (Temperature in Fahrenheit) = 50
Output:
10 degrees in Celsius
Explanation
(50-32) * (5/9) = 18 * (5/9) = 10
```

You can also read about __dynamic array in c__ and __C Static Function____.__

## Approach

The approach to this problem is straightforward:

- We will first take the input in the form of float value from the user, and then we will pass that input to the formula stated above.
- We will store the result of the formula in another float variable.
- After that, we will print that output.

### Implementation in C++

```
// C Program to Convert Fahrenheit to Celsius
#include <stdio.h>
int main() {
float Fahrenheit, Celsius;
scanf("%f", &Fahrenheit);
/* Formula for conversion from Fahrenheit to Celsius */
Celsius = (5*(Fahrenheit - 32)) / 9;
printf("\n%0.2f degree in Fahrenheit is equal to %0.2f degree in Celsius\n", Fahrenheit, Celsius);
return 0;
}
```

**Output:**

```
Input: Fahrenheit = 38
Output: 38.00 degrees in Fahrenheit is equal to 3.33 degrees in Celsius
```

### Complexity Analysis

**Time Complexity: **O(1)

Since we are not using any loop and there are no iterations, we are doing a constant amount of work to get the answer; the time complexity is O(1).

**Space Complexity: **O(1)

Also see, __Tribonacci Series__ and __Short int in C Programming__