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.
Table of Contents
show
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
- The user is asked to enter the temperature in Celsius.
- The input is stored in the variable celsius.
- The value of celsius is converted to a float.
- The value of celsius is multiplied by 9/5 and 32 is added to it.
- The result is stored in the variable Fahrenheit.
- The value of Fahrenheit is printed.