Write a Program to calculate the Perimeter of Hexagon
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.
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:
Enter the length of side of the hexagon:6 Perimeter of the hexagon is: 36.00
Program 2: Write a Program in Java language:
Output of Above Java program:
The Perimeter of a hexagon in Java: 120
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: