Both A and B are correct
There are four influential methods by which minerals formed: Firstly by crystallization from magma, Secondly rainfall, Thirdly shifts in pressure and temperature, and Fourthly formation from hydro thermal liquids.
Some crystals form when molten rock, described as magma below a planet's surface and lava above, cools and molecules bond together into metal crystals. Other minerals develop when water that has particles of suspended elements in it, evaporates away.