Let A and B be the times in minutes it takes each of the pipes to fill the tank, capacity C gallons, working alone.
So B=A-16. The filling rate for A is a=C/A and for B it’s b=C/(A-16).
The tank can be filled in 15 mins when the two pipes are working together at rate a+b.
So 15=C/(a+b), and a+b=C/15, therefore C/A+C/(A-16)=C/15.
C cancels out. Multiply through by 15A(A-16): 15(A-16)+15A=A(A-16).
15A-240+15A=A²-16A, A²-46A+240=0=(A-6)(A-40), A=6 or 40.
We can reject 6, because it would make B negative, so A=40 minutes and B=24 minutes.