Advertisements
Advertisements
प्रश्न
Write a program to calculate how many days of work will be completed by three people A, B, and C together. A, B, and 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.
संक्षेप में उत्तर
Advertisements
उत्तर
Program:
#Asking for the number of days taken by A, B, and 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 people 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 is taken to complete work if A, B and C work together: 3.64shaalaa.com
Operators - Arithmetic Operators (-,+,*,/,%)
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
