Write a program that reads a temperature value and the letter C for Celsius or F for
Fahrenheit. Print
whether water is liquid, solid, or gaseous at the given temperature at sea level.
Help:
For Fahrenheit:
Temperature reading less than or equal to 32 = Solid
Temperature reading greater than 32 and less than 212 = Liquid
Temperature reading greater than or equal to 212 = Gaseous
For Celsius:
Temperature reading less than or equal 0 = Solid
Temperature reading greater than 0 and less than 100 = Liquid
Temperature reading greater than or equal to 100= Gaseous
Answers
Answer:
+ PROJECT
4
Write a C++ program that reads a temperature value and the letter C for Celsius or F for Fahrenheit. Print whether water is liquid, solid, or gaseous
BY · PUBLISHED · UPDATED
The code in Python would be as follows -
#to find whether water is liquid, solid, or gaseous at the given temperature at sea level
temp = float(input('Enter the temperature: '))
unit = input('Enter the unit of temperature (C/F): ')
print('The temperature is', temp,'°', unit)
if unit == 'C':
if temp <= 0:
print('The state of water is solid')
elif temp >= 100:
print('The state of water is gaseous')
else:
print('The state of water is liquid')
if unit == 'F':
if temp <= 32:
print('The state of water is solid')
elif temp >= 212:
print('The state of water is gaseous')
else:
print('The state of water is liquid')
The output has been attached in the images below.
#SPJ2
For more information -
https://brainly.in/question/17474578
https://brainly.in/question/32266295