The most accurate response to how the planets in the solar system were formed is:
The remaining materials from the sun's formation clumped together due to gravity.
This process is part of the nebular hypothesis, which suggests that the solar system formed from a giant cloud of gas and dust (the solar nebula) that collapsed under its own gravity, leading to the formation of the sun and the planets as materials coalesced and formed larger bodies.