Volume is defined a amount of space contained by a body.Now if you want to calculate volume you have to be specific about the solid .
Let me give you a table which has the volumed of various solids.
Rectangular Prism side1 × side2 × side3
Sphere (4/3) ×
Ellipsoid (4/3) ×
Cone (1/3) ×
Pyramid (1/3) × (base area) × height
If what you are asking is to find the formula in a more scientific manner.You can use the law of flotation.
Volume of water displaced = Volume of the block
When you put a solid in a jar of water fill till the brim.Abit of he water spills.If you collect the displaced water and measure it in a beaker you will find the volume of the substance