Regular Polygons

 

Still on mathematical problems. High school students usually forget about the formulae to calculate the interior angle and the exterior angle of a regular polygon, so you can design a VB program to help your friends, your siblings or your children to solve such problems. Here is the program I have designed today, you can always modify the codes.

 

Private Sub cmd_Cal_Click()

Dim n As Integer
Dim sum, x, y As Single
n = Val(Txt_n.Text)
sum = (n - 2) * 180
x = sum / n
y = 180 - x
Lbl_SumIntAngle.Caption = Round(sum, 2)
Lbl_IntAngle.Caption = Round(x, 2)
Lbl_ExtAngle.Caption = Round(y, 2)

End Sub


 

Explantion

The sum of Interior angles of a polygon=(n-2)x180

Each Interior angle= (sum of interior angles)/n

Exterior angle=180-interior angle

 

 

 

 

 

 

 [Back to VBToday]