Java Program for Program to calculate area of a Tetrahedron
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 or 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
// Java code to find the volume of a tetrahedron import java.io.*; 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 ; System.out.println(vol); } } |
chevron_right
filter_none
Output :
3.18
Please refer complete article on Program to calculate area of a Tetrahedron for more details!
Recommended Posts:
- Python Program for Program to calculate area of a Tetrahedron
- Program to calculate area of a Tetrahedron
- Program to calculate area and volume of a Tetrahedron
- Program to calculate the area of Kite
- Program to calculate Area Of Octagon
- Program to calculate area and perimeter of Trapezium
- Program to calculate area and perimeter of equilateral triangle
- Program to calculate Volume and Surface area of Hemisphere
- Program to calculate area and perimeter of a rhombus whose diagonals are given
- Program to calculate area of a rhombus whose one side and diagonal are given
- Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle
- Java Program for Program to find area of a circle
- Program to calculate area of inner circle which passes through center of outer circle and touches its circumference
- Program to find the Volume of an irregular tetrahedron
- Program to calculate the value of nPr