wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Write a program to calculate in how many days a work will be completed by three persons A, B and C together. A, B, C take x days, y days and z days respectively to do the job alone. The formula to calculate the number of days if they work together is xyz/(xy + yz + xz) days where x, y, and z are given as input to the program.

Open in App
Solution

Program:

#Asking for the number of days taken by A, B, C to complete the work alone
x = int(input('Enter the number of days required by A to complete work alone: '))
y = int(input('Enter the number of days required by B to complete work alone: '))
z = int(input('Enter the number of days required by C to complete work alone: '))

#calculating the time if all three person work together
#formula used as per the question

combined = (x * y * z)/(x*y + y*z + x*z)
#rounding the answer to 2 decimal places for easy readability
days = round(combined,2)
#printing the total time taken by all three persons
print('Total time taken to complete work if A, B and C work together: ', days)


OUTPUT:-
Enter the number of days required by A to complete work alone: 8
Enter the number of days required by B to complete work alone: 10
Enter the number of days required by C to complete work alone: 20
Total time taken to complete work if A, B and C work together: 3.64

flag
Suggest Corrections
thumbs-up
1
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Introduction to Bill of Exchange
ACCOUNTANCY
Watch in App
Join BYJU'S Learning Program
CrossIcon