Habitable zone in a planetary system is defined as the region around a star where life-supporting planets can exist. Typically it requires the presence of liquid water on the planetary surface. Considering the formation of planetary systems, we investigate how stellar mass affects the probability of terrestrial planets formed within habitable zone. We use our Planetary System Generator code (Yamani, 2007) to generate planetary systems by investigating its sensitivity through several parameters, such as stellar mass, stellar luminosity, and effective temperature. The probability of finding terrestrial planets within the habitable zone of extrasolar planetary system has been then calculated. We selected the exoplanet systems: Gl 581, HD 128311, 55 Cnc, 47 UMa, and Ups And-like to evaluate the presence of planets within their habitable zone.