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


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

六角柱是一个三维图形,其两端都有一个六边形。柱体上的考试如下所示 -

在数学中,六角柱被定义为具有 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

更新于:09-8 月-2019

391 次浏览

开始你的职业生涯

通过完成课程获得认证

开始吧
广告