Learn Programming and technology with ease @ developerpublish.com

HomePythonPython Program to Convert Celsius to Fahrenheit

# Python Program to Convert Celsius to Fahrenheit

In this Python program, we will convert temperature values from Celsius to Fahrenheit. The Celsius and Fahrenheit scales are two common temperature scales used around the world. Converting Celsius to Fahrenheit involves a simple mathematical formula.

## Problem Statement

Given a temperature value in Celsius, we need to convert it to the corresponding value in Fahrenheit.

## Python Program to Convert Celsius to Fahrenheit

```def celsius_to_fahrenheit(celsius):
fahrenheit = (celsius * 9/5) + 32
return fahrenheit

# Test the program
celsius = float(input("Enter the temperature in Celsius: "))
fahrenheit = celsius_to_fahrenheit(celsius)

print(f"Temperature in Fahrenheit: {fahrenheit}Â°F")
```

## How It Works

1. The function `celsius_to_fahrenheit(celsius)` takes a temperature value in Celsius as input and returns the corresponding temperature value in Fahrenheit.
2. The conversion formula from Celsius to Fahrenheit is: `F = (C * 9/5) + 32`, where `F` represents Fahrenheit and `C` represents Celsius.
3. We apply the formula to the input Celsius value and store the result in the variable `fahrenheit`.
4. Finally, we return `fahrenheit`, which represents the temperature value in Fahrenheit.

## Input/Output

### You May Also Like

#### Python Program to Remove Duplicates from a Linked List

In this Python program, we will create a singly linked list and remove duplicate elements from it. A linked list...

#### Python Program to Solve the Celebrity Problem

This Python program solves the Celebrity Problem by finding a person who is known by everyone but does not know...

#### Python Program to Solve n-Queen Problem with Recursion

This Python program uses a recursive approach to solve the n-Queens problem. It explores all possible combinations of queen placements...