Java Program to Find Volume of Octahedron

bookmark

import java.io.*;
class Main
{
    public static void main(String [] args)
    {
        // value of one side of the octahedron
        int l = 5; 
        // formula to find vol of octahedron
        double vol = ((Math.sqrt(2))*(5*5*5))/3;       
        System.out.println("The volume of octahedron is:" + vol);
    }
}

 


Output:

The volume of octahedron is:58.92556509887896