Volume of cube using its space diagonal | Java program to find the volume occupied by Cube with given space diagonal ; Function to calculate Volume ; Formula to find Volume ; Drivers code ; space diagonal of Cube
public class GFG { static float CubeVolume ( float d ) { float Volume ; Volume = ( float ) ( Math . sqrt ( 3 ) * Math . pow ( d , 3 ) ) / 9 ; return Volume ; } public static void main ( String [ ] args ) { float d = 5 ; System . out . println ( " Volume ▁ of ▁ Cube : ▁ " + CubeVolume ( d ) ) ; } }