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 次瀏覽

開始你的職業生涯

透過完成課程獲得認證

開始吧
廣告
© . All rights reserved.