Home » Write a Program to find the Area of Hexagonal Prism

Write a Program to find the Area of Hexagonal Prism

by Online Tutorials Library

Write a Program to find the Area of Hexagonal Prism

Before writing the program of calculating the area of a hexagonal prism in different programming languages, firstly we have to know about the hexagonal prism and its formulae of surface area.

What is Hexagonal Prism?

Hexagonal Prism is a 3-D shape, which has 8 faces, 12 vertices, and 18 edges. The two faces at either ends of the prism are hexagons, and the rest of the faces of the hexagonal prism are rectangular.

Area of Hexagonal Prism

Program of calculating the area of a hexagonal prism in different Programming languages

Program 1: Write a Program in C language:

Output of Above C program:

Surface area of the hexagonal prism  is: 356.003387  

Program 2: Write a Program in Java language:

Output of Above Java program:

The area of a hexagonal prism is:  3278.460969082653  

Program 3: Write a Program in PHP programming language.

Output of Above PHP program:

179.13843876331  

Program 4: Write a Program in Python programming language.

Output of Above Python program:

179.1384387633061  

You may also like