Computer Science, asked by devenduhan100, 9 months ago

Q-1: Write a program to accept two distances(first distance in feet and inches & second distance in feet and inches……….4 values are to be accepted by user).Display the sum of these two distances with feet & inches.
Python

Answers

Answered by dawnofanera122
0

Answer (copy paste the code below, and inside the while loop, add spaces to the lines where totaldistance -= 1 and finalfeet += 1, I have tested it, but you can also test it. Please mark this answer as the brainliest if it helps.):

feet1 = int(input("Enter the no. of feet for the first distance"))

inches1 = int(input("Enter the no. of inches for the first distance"))

totalinches1= inches1 + 12 * feet1

feet2 = int(input("Enter the no. of feet for the second distance"))

inches2 = int(input("Enter the no. of inches for the second distance"))

totalinches2 = inches2 + 12 * feet2

totaldistance = totalinches1 + totalinches2

finalfeet = 0

while totaldistance > 12:  

totaldistance -= 12

finalfeet += 1

print("The final distance is" , finalfeet , "feet and" , totaldistance , "inches")

Similar questions