Python Program to Convert Celsius to Fahrenheit

python program to convert celsius to fahrenheit; Through this tutorial, i am going to show you how to convert celsius to fahrenheit in python.

Python Program to Convert Celsius to Fahrenheit

Use the following math formula with python program to convert celsius to fahrenheit and fahrenheit to celsius:

  • Formula Celsius to Fahrenheit:
    • Celsius = (Fahrenheit – 32) * 5/9
  • Fahrenheit to celsius:
    • Fahrenheit = (Celsius * 9/5) + 32

Python program to convert temperature from Celsius to Fahrenheit

# Python program to convert temperature from Celsius to Fahrenheit
celsius = float(input("Enter temperature in celsius :- "))
fahrenheit = (celsius * 9/5) + 32
print('%.2f Celsius is :- %0.2f Fahrenheit' %(celsius, fahrenheit))

Output

Enter temperature in celsius :-  15
15.00 Celsius is :- 59.00 Fahrenheit

Python program to convert Fahrenheit to Celsius

# Python program to convert Fahrenheit to Celsius
fahrenheit = float(input("Enter temperature in fahrenheit :- "))
celsius = (fahrenheit - 32) * 5/9
print('%.2f Fahrenheit is :- %0.2f Celsius' %(fahrenheit, celsius))

Output

Enter temperature in fahrenheit :-  60
60.00 Fahrenheit is :- 15.56 Celsius

Recommended Python Tutorials

Be First to Comment

Leave a Reply

Your email address will not be published.