Python Program to Convert Celsius to Fahrenheit

When it comes to converting Celsius to Fahrenheit, it is really quite simple. All you need to do is multiply the Celsius temperature by 9/5 and add 32. This will give you the equivalent Fahrenheit temperature.

For example, if the temperature outside is 10 degrees Celsius, then the equivalent Fahrenheit temperature would be 50 degrees (10 x 9/5) + 32 = 50.

Program Code

celsius = float(input("Enter the temperature in celsius: "))
fahrenheit = (celsius * 9/5) + 32
print("The temperature in fahrenheit is: ", fahrenheit)

Input Given:

Enter the temperature in celsius: 30

Expected Output:

The temperature in fahrenheit is: 86.0

Code Explanation

  1. The user is asked to enter the temperature in Celsius.
  2. The input is stored in the variable celsius.
  3. The value of celsius is converted to a float.
  4. The value of celsius is multiplied by 9/5 and 32 is added to it.
  5. The result is stored in the variable Fahrenheit.
  6. The value of Fahrenheit is printed.

Leave a Comment

Share to...