Python Program to Convert Celsius To Fahrenheit

Here we will a program to convert Celsius to Fahrenheit in Python, lets first understand how to convert Celsius to Fahrenheit.

How to convert?

We will use the simple formula for the conversion of temperature from Celsius to Fahrenheit.

celsius * 1.8 = fahrenheit - 32

Now lets write the code for the same.

Python Program to Convert Celsius To Fahrenheit

# Python Program to convert temperature in celsius to fahrenheit

# change this value for a different result
celsius = 37.5

# calculate fahrenheit
fahrenheit = (celsius * 1.8) + 32
print('%0.1f degree Celsius is equal to %0.1f degree Fahrenheit' %(celsius,fahrenheit))

OUTPUT:

37.5 degree Celsius is equal to 99.5 degree Fahrenheit

Now we also write the program for converting temperature from Fahrenheit to Celsius, I know you can guess that. Right use this formula:

celsius = (fahrenheit - 32) / 1.8

Please comment for any concerns or issues.

Leave a Comment