To differentiate a transistor from an IC is a problem for me. Because some transistors usually have numbers that are almost the same as that of an IC. Pls help me out.
A transistor is the one with three pins.... Some have numbers starting with 2N.... BC... But that is just something you have to learn by reading manuals.
There are a few ICs that look like transistors. Such as voltage regulators like the 78L05 or LP2950 and temperature sensors, such as the LM335, etc. So, as you point out, you can't always tell a part by it's cover. BUT, you _can _ attempt to look up the part number.
If you know the manufacturer, you can usually find a datasheet on their website, or look it up on Digi-Key and click on the "Specification Sheet" link--that is, if Digi-Key happens to carry that part. If the manufacturer is unavailable, then you can try Googling the part number. There is the rare case where dissimilar parts have the same, or similar part number. Usually they are different enough that you can discern the difference by physical characteristics. Otherwise, in a small percentage of cases you might just be screwed ;)
A note on determining the manufacturer: often there is a little symbol (icon) on the part. Often, this can be used to identify the manufacturer. Here are some sites that list manufacturers by their logo: