Let x = number of hours to fill the tank if both pipes are open
1/6 = portion of tank filled per hour by the first pipe
1/8 = portion of tank emptied per hour by the second pipe
1/x = portion of tank filled per hour if both pipes are open
Then, 1/6 - 1/8 = 1/x
Multiply by the LCD, 24x: 4x - 3x = 24
x = 24 hours