Home > Backend Development > C++ > body text

Program to calculate the area of ​​a tetrahedron

WBOY
Release: 2023-09-08 09:25:01
forward
591 people have browsed it

Program to calculate the area of ​​a tetrahedron

The tetrahedron is a pyramid with a triangular base, that is, its base is a triangle and each side has a triangle. All three triangles converge to one point. As shown in the figure,

Tetrahedral area = (√3)a2

Program to calculate the area of ​​a tetrahedron

##Example

Find the tetrahedral area The code uses the math library to find the square and square root of a number, using the sqrt and pow methods. To calculate the area, we take a floating point number and give the value of the expression "((sqrt(3)*a*a))".

#include <stdio.h>
#include <math.h>
int main() {
   int a= 5;
   float area, volume;
   printf("Program to find area and volume of Tetrahedron</p><p>");
   printf("The side of Tetrahedron is %d </p><p>", a);
   area = (sqrt(3)*(a * a));
   printf("The area of Tetrahedron is %f </p><p>", area);
   return 0;
}
Copy after login

Output

Program to find area and volume of Tetrahedron
The side of Tetrahedron is 5
The area of Tetrahedron is 43.301270
Copy after login

The above is the detailed content of Program to calculate the area of ​​a tetrahedron. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template