हिंदी

Write a program to find sum of two distances with feet and inches.

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
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 1: Review of Phython - EXERCISE [पृष्ठ २७]

APPEARS IN

सीबीएसई Computer Science with Python [English] Class 12
अध्याय 1 Review of Phython
EXERCISE | Q 18. | पृष्ठ २७
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×