SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Y Daniel Lang
Chapter:
Programming
Exercise:
Programming Excercises
Question:1 | ISBN:978013274719 | Edition: 6

Question

(Convert Celsius to Fahrenheit) Write a program that reads a Celsius degree from the console and converts it to Fahrenheit and displays the result. The formula for the conversion is as follows:
                           fahrenheit = (9 / 5) * celsius + 32

Here is a sample run of the program:

Enter a degree in Celsius:43

43 Celsius is 109.4 Fahrenheit
 

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

Program:

celsius =float(input("Enter a degree in Celsius:"))
fahrenheit = (9 / 5) * celsius + 32
print(celsius, "Celsius is ", fahrenheit ,"Fahrenheit")

Sample run of the program:

Python 3.2.1 (default, Jul 10 2011, 21:51:15) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>> 
Enter a degree in Celsius:43
43.0 Celsius is  109.4 Fahrenheit
>>> 

 

0 0

Discussions

Post the discussion to improve the above solution.