Programming a hexagon
Let's modify our pentagon program to draw a hexagon. The first thing we need to do is understand how a hexagon is different from a pentagon.
A hexagon has six sides. The angle size is determined by dividing the total of the angles by the number of sides. The total is always 360 degrees.
A hexagon has six sides. The angle size is determined by dividing the total of the angles by the number of sides. The total is always 360 degrees.
To draw the hexagon we need to repeat our instructions 6 times and change the angle size to 60 degrees.
Here is the program. Click on it to interact with it.
Math exists in the real world. Click here to see.