fastread homefastrread library fastread menu

Python : Convert Celsius To Fahrenheit

Tutorial by:Rizwan Abdullah      Date: 2016-06-16 00:48:40

❰ Previous Next ❱

Source Code

# Python Program to convert temperature in celsius to fahrenheit 
# Input is provided by the user in degree celsius

# take input from the user
celsius = float(input('Enter degree Celsius: '))

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


Enter degree Celsius: 37.5
37.5 degree Celsius is equal to 99.5 degree Fahrenheit

In this program, we ask the user for temperature in degree Celsius and convert it into degree Fahrenheit. They are related by the formula celsius * 1.8 = fahrenheit - 32. With a simple modification to this program, we can convert Fahrenheit into Celsius. We ask the user for temperature in Fahrenheit and use the following formula to convert it into Celsius.

celsius = (fahrenheit - 32) / 1.8

❰ Previous Next ❱


Submit Your Thought, Tutorial, Articls etc.

Submit Your Information India's Number one online promotion website