This is a typical work problem in algebra. The approach to this is using the equation: Rt = 1, where R is the rate per person working, t is the amount of time worked by an individual. All their rates must equal to 1. The solution is as follows:
12/x + 15/x = 1
Solving for x,
x = 27 hours
So, if they work together, they can finish the work in 27 hours.