Before writing the program of calculating the perimeter of hexagon in different programming languages, firstly we have to know about what is hexagon and what is the formula to find perimeter of it?
What is Hexagon?
A hexagon is a 6-sided, 2-dimensional geometric figure. The total of the internal angles of any hexagon is 720°. A regular hexagon has 6 rotational symmetries and 6 reflection symmetries. All internal angles are 120 degrees.
Perimeter of Hexagon = 6 * a,
where, a is the side length of Hexagon.
Program of calculating the perimeter of a hexagon in different Programming languages
Program 1: Write a Program in C language:
Output of Above C program:
Program 2: Write a Program in Java language:
Output of Above Java program:
Program 3: Write a Program in PHP programming language.
Output of Above PHP program:
Program 4: Write a Program in Python programming language.
Output of Above Python program: