If possible, and only if you can do it safely-locate the fire. Remember to stay calm. Alert any other people that are in the building, preferably by pulling the nearest fire alarm (when in a public building). If the fire is small and a fire extinguisher is handy, an attempt to put the fire out should be made. If the fire is already large, or you fail to extinguish it, you must evacuate the building as safely and as quickly as possible. Keep in mind that fires can spread very quickly so it is better to err on the side of caution by getting the fire department started before the fire is out of control.
Feel any door before opening it, and if it is hot, do not open it. Try to exit the building without going through an area that is in flames, then stop, drop, and crawl. Call the fire department.