#includeintmain(){ inta=5; &nb"/> #includeintmain(){ inta=5; &nb">

Home >Backend Development >C++ >Program to calculate the area of ​​a tetrahedron

Program to calculate the area of ​​a tetrahedron

WBOY
WBOYforward
2023-09-08 09:25:01625browse

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;
}

Output

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

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete