Write a program that displays a table of Celsius temperatures 0 through a number entered by…
The following solution is suggested to handle the subject “Write a program that displays a table of Celsius temperatures 0 through a number entered by…“. Let’s keep an eye on the content below!
Question “Write a program that displays a table of Celsius temperatures 0 through a number entered by…”
Write a program that displays a table of Celsius temperatures 0
through a number entered by the user and their Fahrenheit
equivalents as in the figure below. The formula for converting a
Celsius temperature to a Fahrenheit temperature is:
F = 9 / 5 * C + 32
where F is the Fahrenheit temperature and C is the Celsius
Temperature. Your program must use a ‘for’ loop. Display all
temperatures to one decimal place.
Answer
CODE
==============
n = int (input(“Enter number of celsius temperature to display:”))
print(“Celsius Fahrenheit”)
for i in range(n+1):
fahrenheit = (i * 1.8) + 32
if i < 10:
print(“%.1f %.1f” %(i, fahrenheit))
else:
print(“%.1f %.1f” %(i, fahrenheit))
Conclusion
Above is the solution for “Write a program that displays a table of Celsius temperatures 0 through a number entered by…“. We hope that you find a good answer and gain the knowledge about this topic of engineering.