Python Program to Convert Celsius to Fahrenheit

« Previous Program Next Program »

Convert Celsius to Fahrenheit in Python

To convert temperature from Celsius to Fahrenheit in python, you have to ask from user to enter the temperature in Celsius to convert that temperature into Fahrenheit as shown in the program given below.

Let's suppose, there is c temperature given in celsius and you have to find out the temperature in fahrenheit, that is f, then use the following conversion factor:

f = (1.8 x c) + 32

Python Programming Code to Convert Celsius to Fahrenheit

Following python program ask from user to enter Celsius to convert it into Fahrenheit:

# Python Program - Convert Celsius to Fahrenheit

print("Enter 'x' for exit.");
cel = input("Enter Temperature in Celsius: ");
if cel == 'x':
    celsius = float(cel);
    fahrenheit = (1.8*celsius) + 32;
    print("Temperature in Fahrenheit =",fahrenheit);

Here is the sample run of the above Python program to illustrate how to convert Celsius to Fahrenheit temperature:

convert celsius to fahrenheit python

Now enter temperature in celsius say 37 degree celsius and press enter to convert temperature into degree fahrenheit as shown here in following output:

celsius to fahrenheit python

Below is same program on python shell:

python convert celsius to fahrenheit

Same Program in Other Languages

You may also like to learn or practice the same program in other popular programming languages:

« Previous Program Next Program »


Quick Links
Signup - Login - Give Online Test