计算四面体的表面积程序
四面体是具有三角形底座的金字塔,即它的底座是一个三角形,且每侧都有一个三角形。全部三个三角形汇聚于一点。如下图所示:
四面体的表面积 = (√3)a2

示例
获取四面体面积的代码使用 math 库来使用 sqrt 和 pow 方法获取数字的平方和平方根。为了计算面积,我们采用了一个浮点,并将其赋值为表达式“((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
");
printf("The side of Tetrahedron is %d
", a);
area = (sqrt(3)*(a * a));
printf("The area of Tetrahedron is %f
", area);
return 0;
}输出
Program to find area and volume of Tetrahedron The side of Tetrahedron is 5 The area of Tetrahedron is 43.301270
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP