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 area of Tetrahedron can be found by using the formula :
Area = sqrt(3)*(side*side)
Examples :
Input : side = 3
Output : 15.5885
Input : side = 20
Output : 692.82
C
#include<iostream>
#include<math.h>
using namespace std;
double area_of_tetrahedron( int side)
{
return ( sqrt (3)*(side*side));
}
int main()
{
int side=3;
cout<< "Area of Tetrahedron ="
<< area_of_tetrahedron(side);
}
|
Java
import java.util.*;
import java.lang.*;
class GFG {
public static double area_of_tetrahedron( int side)
{
return (Math.sqrt( 3 ) * (side * side));
}
public static void main(String[] args)
{
int side = 3 ;
System.out.println( "Area of Tetrahedron ="
+ area_of_tetrahedron(side));
}
}
|
Python3
import math
def area_of_tetrahedron(side):
return (math.sqrt( 3 ) *
(side * side));
side = 3 ;
print ( "Area of Tetrahedron = " ,
round (area_of_tetrahedron(side), 4 ));
|
C#
using System;
class GFG
{
public static double area_of_tetrahedron( int side)
{
return (Math.Sqrt(3) *
(side * side));
}
static public void Main ()
{
int side = 3;
Console.WriteLine( "Area of Tetrahedron = " +
area_of_tetrahedron(side));
}
}
|
PHP
<?php
function area_of_tetrahedron( $side )
{
return (sqrt(3) * ( $side * $side ));
}
$side = 3;
echo "Area of Tetrahedron = " ,
area_of_tetrahedron( $side );
?>
|
Output :
Area of Tetrahedron =15.5885
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
C/C++
#include <math.h>
#include <stdio.h>
double vol_tetra( int side)
{
double volume = ( pow (side, 3) / (6 * sqrt (2)));
return volume;
}
int main()
{
int side = 3;
double vol = vol_tetra(side);
printf ( "%.2f" , vol);
}
|
Java
import java.io.*;
class Tetrahedron {
static double vol_tetra( int side)
{
double volume = (Math.pow(side, 3 ) / ( 6 * Math.sqrt( 2 )));
return volume;
}
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);
}
}
|
Python
import math
def vol_tetra(side):
volume = (side * * 3 / ( 6 * math.sqrt( 2 )))
return round (volume, 2 )
side = 3
vol = vol_tetra(side)
print (vol)
|
C#
using System;
class Tetrahedron {
static double vol_tetra( int side)
{
double volume = (Math.Pow(side, 3) / (6 * Math.Sqrt(2)));
return volume;
}
public static void Main()
{
int side = 3;
double vol = vol_tetra(side);
vol = ( double )Math.Round(vol * 100) / 100;
Console.WriteLine(vol);
}
}
|
PHP
<?php
function vol_tetra( $side )
{
$volume = (pow( $side , 3) /
(6 * sqrt(2)));
return $volume ;
}
$side = 3;
$vol = vol_tetra( $side );
echo $vol ;
?>
|
Output :
3.18
leave a comment
0 Comments