Python Program to Convert Celsius To Fahrenheit Ad Sponsored

ⓘ Sponsored by

The formula used to convert Celcius to Fahrenheit is °F = °C x 1.8 + 32. For example, if you want to convert 30 degrees Celsius to Fahrenheit, you would do: °F = 30 x 1.8 + 32 °F = 54 + 32 °F = 86 So, 30 degrees Celsius is equal to 86 degrees Fahrenheit.

Python Code :

The below Python program to converts Celsius to Fahrenheit:

# Get input temperature in Celsius from user
celsius = float(input("Enter temperature in Celsius: "))

# Convert Celsius to Fahrenheit using the formula (Celsius * 9/5) + 32
fahrenheit = (celsius * 9/5) + 32

# Print the result
print(celsius, "degrees Celsius is equal to", fahrenheit, "degrees Fahrenheit")

In this program, the user is prompted to enter a temperature in Celsius.

The temperature is then converted to Fahrenheit using the formula (Celsius * 9/5) + 32, which is the conversion formula from Celsius to Fahrenheit.

The converted temperature is stored in the variable fahrenheit.

Finally, the program prints out the original temperature in Celsius and the converted temperature in Fahrenheit using the print function.

Note that this program assumes that the user enters a valid floating-point number for the temperature in Celsius.

If the user enters an invalid input, such as a string or a temperature below absolute zero, the program will raise a ValueError or produce an incorrect result.

For example :

Enter temperature in Celsius: 100
100.0 degrees Celsius is equal to 212.0 degrees Fahrenheit Ad Sponsored

ⓘ Sponsored by