Final answer:
The U-shaped trap was created to prevent sewer gases from entering buildings through WCs by maintaining a water seal.
Step-by-step explanation:
The U-shaped trap was invented to solve the other problem of WCs. This type of trap, also known as the U-bend, is a curved section of plumbing that uses a water seal to prevent sewer gases from entering the building through a toilet, sink, or other fixture. It maintains a constant amount of water in the bend, effectively sealing off the end of the pipe and stopping any gas from coming back into the house.