john can complete a given task in 18 days . jane will take only 12 days to complete the same task . john and jane set out to complete the task by beginning to work together . however , jane was indisposed 6 days before the work got over . in how many days did the work get over from the time john and jane started to work on it together ?
"in such questions , you need to start from the end . last 4 days john works alone and completes 6 * ( 1 / 18 ) = 1 / 3 of the work . so 2 / 3 of the work should have been completed by the two of them together before jane left . their combined rate of work is 1 / 18 + 1 / 12 = 5 / 36 time taken to complete 2 / 3 of the work = ( 2 / 3 ) / ( 5 / 36 ) = 24 / 5 days . so total number of days taken to complete the work = 24 / 5 + 6 = 54 / 5 days . d"
add(6, divide(subtract(multiply(18, 12), multiply(12, 6)), add(12, 18)))