Home > Article > Backend Development > Calculation of surface area and volume of hexagonal prism in C programming
The surface area of any figure is the total area covered by its surface.
A hexagonal prism is a three-dimensional figure with hexagons on both ends. The Prism Exam looks like -
In mathematics, a hexagonal prism is defined as a three-dimensional figure with 8 faces, 18 sides, and 12 vertices.
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</p><p>",Area); //Logic to find the Volume of hexagonal prism float Volume; Volume = 3 * sqrt(3) * a * a * h / 2; printf("Volume: %f</p><p>",Volume); return 0; }
Surface Area: 429.903809 Volume: 649.519043
The above is the detailed content of Calculation of surface area and volume of hexagonal prism in C programming. For more information, please follow other related articles on the PHP Chinese website!