Advertisements
Advertisements
प्रश्न
Write a program to find sum of two distances with feet and inches.
कोड लेखन
Advertisements
उत्तर
Add feet and inches; if inches are 12 or more, convert them into feet.
feet1 = int(input("Enter first distance in feet: "))
inches1 = int(input("Enter first distance in inches: "))
feet2 = int(input("Enter second distance in feet: "))
inches2 = int(input("Enter second distance in inches: "))
feet = feet1 + feet2
inches = inches1 + inches2
if inches >= 12:
feet += inches // 12
inches %= 12
print("Sum of distances =", feet, "feet", inches, "inches")shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
