There are four factors that determine if your roof is a good fit for solar:
Ideally, you should have a south-facing roof. In the northern hemisphere, south-facing roofs maximize the amount of sunlight your solar panels collect. The more sunlight they collect, the more electricity they produce, and the quicker you can pay off your system. You can still mount solar panels to your roof if it faces due east or west, but the panels will produce less energy (about 75% of what a south-facing roof would produce). If you have a flat roof, the panels can be engineered to face due south no matter how your roof is oriented.