If you look at the underside of an iMac’s foot you’ll find the serial number. You might need a magnifying glass. More details at Apple’s site. MacBook Pros and other laptops have the serial number on the underside of the case.
There’s an easier way.