首页 > 文章列表 > 六角柱的表面积和体积在C编程中的计算

六角柱的表面积和体积在C编程中的计算

计算 体积 关键词:六角柱 表面积
409 2023-09-13

任何图形的表面积都是其表面覆盖的总面积。

六角棱柱是两端都有六边形的三维图形。棱柱考试看起来像 -

在数学中,六角棱柱被定义为具有 8 个面、18 个边、12 个顶点的三维图形。

Surface Area = 3ah + 3√3*(a2)
Volume = (3√3/2)a2h

示例

#include <stdio.h>
#include<math.h>
int main() {
   float a = 5, h = 10;
   //Logic to find the area of hexagonal prism
   float Area;
   Area = 6 * a * h + 3 * sqrt(3) * a * a;
   printf("Surface Area: %f

",Area);    //Logic to find the Volume of hexagonal prism    float Volume;    Volume = 3 * sqrt(3) * a * a * h / 2;    printf("Volume: %f

",Volume);    return 0; }

输出

Surface Area: 429.903809
Volume: 649.519043