Answer:
Magma is formed when hot liquid comes from the earth's core into the cold crust of the Earth. When this liquid solidifies it loses heat to the surrounding crust and begins to melt the surrounding rock.
Sediments are formed when magma rises to Earth's surface from a volcanic eruption where the magma cools into igneous rock. On the surface, weathering and erosion break down the igneous rock into pebbles, sand, and mud, creating sediment, which accumulates in basins on the Earth's surface.
When sediment becomes compacted and cemented together it forms a type of rock called sedimentary rock