Skip to content
Related Articles

Related Articles

Java Program for Program to calculate volume of a Tetrahedron

Improve Article
Save Article
  • Last Updated : 07 Aug, 2022
Improve Article
Save Article

A Tetrahedron is simply a pyramid with a triangular base. It is a solid object with four triangular faces, three on the sides or lateral faces, one on the bottom of the base and four vertices or corners. If the faces are all congruent equilateral triangles, then the tetrahedron is called regular. 

The volume of the tetrahedron can be found by using the following formula :

Volume = a3/(6√2)

Examples : 

Input : side = 3
Output: 3.18

Input : side = 20
Output: 942.81



// Java code to find the volume of a tetrahedron
class Tetrahedron {
    // Function to calculate volume
    static double vol_tetra(int side)
        double volume = (Math.pow(side, 3) / (6 * Math.sqrt(2)));
        return volume;
    // Driver Code
    public static void main(String[] args)
        int side = 3;
        double vol = vol_tetra(side);
        vol = (double)Math.round(vol * 100) / 100;



Time Complexity: O(1)

Space Complexity: O(1)

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!