Python - Covert Celsius to Fahrenheit

In this program, you will learn how to convert temerature from Celsius to Fahrenheit.


Program: Celsius to Fahrenheit



    
    # This program to convert the temperature from celsius to fahrenheit

    #celsius = 45.5
    celsius = float(input('Enter the value in celsius: '))
    
    #convert celsius to fahrenheit
    fahrenheit = (celsius * 1.8) + 32
    
    print('%0.1f degree Celsius is equal to %0.1f Fahrenheit' %(celsius,fahrenheit))
    
            
            

Output


    Enter the value in celsius: 65
    65.0 degree Celsius is equal to 149.0 Fahrenheit
        
            

In this program, we have used celsius variable to hold the entered temperature celsius value.

And, we have used the following formual to convert temperature from Celsius to Fahrenheit

    fahrenheit = (celsius * 1.8) + 32
            

Use the following formual to convert temperature from Fahrenheit to Celsius

    celsius =  (fahrenheit - 32) / 1.8
            



The following topics can be useful to understand this program.



Related Tutorials