Let the work was done in x days
'C' leaves 4 days before completion
Therefore, According to given data
\( \Large \frac{x}{24}+\frac{x}{30}+\frac{ \left(x-4\right) }{40} = 1 \)
=> \( \Large \frac{5x+4x+3 \left(x-4\right) }{120} = 1 \)
=> \( 12x - 12 = 120 => x = 11 days \)