Answers for "temperature conversion in c++"

C++
0

temperature conversion in c++

#TemperatureConversions.py

def main():
	units = input("Which temperature you are using? (F for Fahrenheit, C for Celsius): ")
	temp = eval(input("Please enter the temperature: "))
	if (units == 'F'):
		celcius = 5*(temp - 32)/9
		print("The temperature is", celcius, "Celcius.")
	else:
		fahrenheit = 9*temp / 5+32
		print("The temperature is", fahrenheit, "Fahrenheig")
main()
Posted by: Guest on September-25-2020

Browse Popular Code Answers by Language