Igneous rocks are formed by the continuous heating and cooling of molten magma.
Due to wind or water, the igneous rock breaks into fragments and settles as sediments. Over time, due to deposition of subsequent layers under high pressure, sedimentary rocks are formed.
When rocks change their original form due to intense heat and pressure, they transform into metamorphic rocks.