In this post, we will be investigating the ** Python Program to Convert Celsius to Fahrenheit**. We will convert Celsius to Fahrenheit and clarify the linguistic structure; simply referred to as syntax of the program.

## Algorithm to Convert Celsius to Fahrenheit

In order to convert Celsius to Fahrenheit, we have a conversion factor of `1.8`

. We will use three variables; **cel, fah, **and **con_fac** to represent the temperature in Celsius, temperature in Fahrenheit and the conversion factor.

Let us take a look to the algorithm to convert Celsius to Fahrenheit in Python.

```
Step 1: Start
Step 2: Initialize the value for cel variable
Step 3: Multiply the cel value with the con_fac (=1.8) and add 32 to obtain fah i.e.
fah = cel * 1.8 + 32
Step 4: Display the fah value i.e.
print(fah)
Step 5: End
```

*New to Python Programming?**Start with Python Programming!*

## Convert Celsius to Fahrenheit in Python

Focusing on the program to convert celsius to fahrenheit, let’s jump into the source code.

### Example 1: Program with static value

# celsius value cel = 20 #converion factor value con_fac = 1.8 #calculating the fahrenheit fah = cel * con_fac + 32 print('%0.2f celsius is equal to %0.2f fahrenheit'%(cel,fah))

The output of the above code snippet is;

`20.00 celsius is equal to 68 fahrenheit`

### Example 2: Program with dynamic input

# celsius value cel = float(input("Enter the temperature in celsius : ")) #converion factor value con_fac = 1.8 #calculating the fahrenheit fah = cel * con_fac + 32 print('%0.2f celsius is equal to %0.2f fahrenheit'%(cel,fah))

The output for the above code snippet is;

```
Enter the temperature in celsius : 20
20.00 celsius is equal to 68 fahrenheit
```

## Explanation

The basic idea behind the syntax of the function is that we have **1 degree celsius equal to 33.8 (1.8 + 32) fahrenheit**, so we know we can get the equivalent fahrenheit temperature by multiplying the celsius value with this factor (i.e. conversion factor).

Here, in the second example, the user is asked to enter the temperature in celsius which is then stored in the ** cel** variable. After that, it is multiplied with the conversion factor to finally get the equivalent fahrenheit value which is then stored in

**variable.**

*fah*Just like this program, we can also perform the program for the conversion of fahrenheit to celsius as;

`cel = (fah - 32) / 1.8`

You may also check –>