42.1k views
2 votes
Write a program that converts degrees Fahrenheit to Celsius using the following formula. degreesC = 5(degreesF – 32)/9 Prompt the user to enter a temperature in degrees Fahrenheit (just a whole number of degrees without a fractional part), and then let the program print out the equivalent Celsius temperature, including the fractional part to one decimal point. Use the Math.Round(number, decimal) method. A possible dialog might be:______.

Enter a temperature in degrees Fahrenheit: 72 72 degrees Fahrenheit = 22.2 degrees Celsius.

User Eponymous
by
4.2k points

1 Answer

2 votes

Answer:

Written in Python

import math

degreesF = float(input("Enter a temperature in degrees Fahrenheit: "))

degreesC = round(5 * (degreesF - 32)/9,1)

print(degreesC)

Step-by-step explanation:

The following header allows you to use Math.Round() method in Python

import math

The following prompts the user for temperature in degrees Fahrenheit

degreesF = float(input("Enter a temperature in degrees Fahrenheit: "))

The following calculates the degree Celsius equivalent and also round it up

degreesC = round(5 * (degreesF - 32)/9,1)

The following prints the degree Celsius equivalent

print(degreesC)

User Lorenzo Bassetti
by
4.1k points