Finding the center of gravity of any number of bodies when their weights and distances apart of their…