Convert Celsius to Fahrenheit

Convert a temperature from Celsius to Fahrenheit using the standard conversion formula.

PythonBeginner

What You'll Learn

  • Using temperature conversion formulas
  • Working with arithmetic expressions
  • Handling decimal numbers in calculations
Python
# Program to convert Celsius to Fahrenheit

celsius = float(input("Enter temperature in Celsius: "))

# Formula: F = (C * 9/5) + 32
fahrenheit = (celsius * 9/5) + 32

print(celsius, "°C is equal to", fahrenheit, "°F")

Output

Enter temperature in Celsius: 25
25.0 °C is equal to 77.0 °F

Convert Celsius to Fahrenheit in Python

We use the standard temperature conversion formula:

F = (C × 9/5) + 32

Where:

  • F = temperature in Fahrenheit
  • C = temperature in Celsius

Understanding the Formula

The formula converts Celsius to Fahrenheit:

  • Multiply Celsius by 9/5 (or 1.8)
  • Add 32 to the result

Example

If you have 25°C:

  • F = (25 × 9/5) + 32
  • F = (25 × 1.8) + 32
  • F = 45 + 32 = 77°F

Program Logic

python
celsius = float(input("Enter temperature in Celsius: "))
fahrenheit = (celsius * 9/5) + 32
print(celsius, "°C is equal to", fahrenheit, "°F")

Key Takeaways

1

Formula: F = (C × 9/5) + 32

2

Use float for decimal temperatures

3

This is the reverse of Fahrenheit to Celsius conversion

4

Common in weather applications and scientific calculations

Step-by-Step Breakdown

  1. 1Read temperature in Celsius from the user.
  2. 2Apply the conversion formula: F = (C × 9/5) + 32.
  3. 3Store the result in fahrenheit variable.
  4. 4Print both Celsius and Fahrenheit values.