Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Program to calculate area and volume of a Tetrahedron
A tetrahedron is a pyramid with a triangular base i.e. it has a base that is a triangle and each side has a triangle. All the three triangles converge to a point. As shown in the figure −
The code to find the area and volume of tetrahedron uses the math library to find the square and square-root of a number using sqrt() and pow() functions. For a regular tetrahedron with side length a, the surface area and volume can be calculated using specific formulas.
Syntax
Surface Area = ?3 * a² Volume = a³ / (6 * ?2)
Example
This program calculates both the surface area and volume of a regular tetrahedron with a given side length −
#include <stdio.h>
#include <math.h>
int main() {
int a = 5;
float area, volume;
printf("Program to find area and volume of Tetrahedron<br>");
printf("The side of Tetrahedron is %d<br>", a);
// Calculate surface area using formula: ?3 * a²
area = (sqrt(3) * (a * a));
printf("The surface area of Tetrahedron is %.6f<br>", area);
// Calculate volume using formula: a³ / (6 * ?2)
volume = (pow(a, 3) / (6 * sqrt(2)));
printf("The volume of Tetrahedron is %.6f<br>", volume);
return 0;
}
Program to find area and volume of Tetrahedron The side of Tetrahedron is 5 The surface area of Tetrahedron is 43.301270 The volume of Tetrahedron is 14.731391
Key Points
- The formulas work only for regular tetrahedrons where all edges have the same length.
- The
math.hlibrary is required forsqrt()andpow()functions. - Surface area represents the total area of all four triangular faces.
Conclusion
Calculating the area and volume of a regular tetrahedron involves applying mathematical formulas using the sqrt() and pow() functions from the math library. These calculations are essential in geometry and 3D modeling applications.
