'A' and 'B' can do a piece of work in 25 days and 30 days respectively. Both start the work together but 'A' leaves the work 8 days before its completion. Find the time in which the work is finished.

'A' can do 1/25 job per day
'B' can do 1/30 job per day
part of job done in 8 days=8(1/25 + 1/30)
part of job done in rest of days (by 'B' alone)=1-[8(1/25 + 1/30)]
days consumed to finish job by 'B'=(1/25)*[1-[8(1/25 + 1/30)]]
total days to finish job=8+(1/25)*[1-[8(1/25 + 1/30)]]

'A' can do 1/25 job per day
'B' can do 1/30 job per day
part of job done in 6 days=6(1/25 + 1/30)
part of job done in rest of days (by 'B' alone)=1-[6(1/25 + 1/30)]
days consumed to finish job by 'B'=(1/25)*[1-[6(1/25 + 1/30)]]
total days to finish job=6+(1/25)*[1-[6(1/25 + 1/30)]]

Oh, now I get it.
No. of days A and B take to do 1 work: 1/25 + 1/ 30 = 11/ 150= 150/11
In one day, B can do : 8/30th of work.
So, the remaining work is done by both A and B. The remaining work is : 22/30
Now, the time taken by A and B to complete 22/30th work is :\[ \frac{ 22 }{ 30 } \times \frac{ 150 }{ 11 } = 10 days.\]
So, total = 10 + 8 = 18 days.

I would use rate * time = "distance" or in this case
\[ \frac{\text{jobs}}{\text{day}}\cdot { \text{days} }= \text{# of jobs} \]
let T = total number of days for the job. B works for all T days, A works for T-8 days
we have
\[ \frac{1}{25} \cdot (T-8) + \frac{1}{30} T = 1 \]
multiply both sides by 30*25 to "clear" the denominators
\[ 30 (T-8) + 25 T= 750 \\ 55T = 990 \\ T= 18 \]