Python: Program to convert Celsius (centigrade) to Fahrenheit.

Program 4. Write a python program to input temperature in Celsius (centigrade) and convert to Fahrenheit. How to convert temperature from degree centigrade to degree Fahrenheit in python programming. Python program for temperature conversion.

For Example

Input

Temperature in Celsius = 100

Output

Temperature in Fahrenheit = 212 F

Temperature conversion formula

Temperature conversion formula from degree centigrade to Fahrenheit is given by –

Fahrenheit = (Celsius * 9 / 5) + 32.

Logic to convert temperature from Celsius to Fahrenheit

The real logic of this program lies in the conversion formula. We only need to convert the above formula in C programming semantics. Below is the step by step descriptive logic to convert temperature from degree Celsius to Fahrenheit.

  1. Read temperature in Celsius from user in some variable say Celsius.
  2. Apply the formula to convert the temperature to Fahrenheit. Which is

Fahrenheit = (Celsius * 9 / 5) + 32.

  1. Print the value of Fahrenheit.

#Let us now code the solution

#Reads temperature in Celsius

print(“\n\t\t\t https://learnpythonforcbse.wordpress.com/”)

print(“\n Enter temperature in Celsius: “);

Celsius=float(input())

#Celsius to Fahrenheit conversion formula

Fahrenheit = (Celsius * 9 / 5) + 32;

print(“Celsius = “, celsius, “To Fahrenheit = “,fahrenheit)

print(“\n\t\t\t https ://learnpythonforcbse.wordpress.com/”)

OUTPUT:

prog4.png