Program to convert temperature from C° to F° and vice versa
#Program to convert temperature from C° to F° and vice versa
print("1. Program to convert temperature in celsius to fahrenheit ")
print("2. Program to convert temperature in fahrenheit to celsius ")
choice= int(input("Enter your choice - 1 or 2: "))
if choice==1:
#Program to convert temperature in celsius to fahrenheit
c= float(input("Enter temperarure in celsius: "))
f=(c*(9/5))+32
print("Temperature in fahrenheit is",f)
elif choice==2:
#Program to convert temperature in fahrenheit to celsius
a= float(input("Enter temperature in fahrenheit: "))
b=(a-32)*(5/9)
print("Temperature in celsius is",b)
else:
print("Enter 1 or 2")
Comments
Post a Comment